Hi! I have a simple class of eureka client:

@EnableFeignClients("refresher")
@SpringBootApplication
@EnableEurekaClient
public class SecondServiceApplication  {

    @Autowired
    private ZuulRefresher zuulRefresher;

    public static void main(String[] args) {
        SpringApplication.run(SecondServiceApplication.class, args);
    }

    private void refresh() {
        zuulRefresher.refresh();
    }
}

How can I call refresh method rigth after registration my service in eureka server???

Comment From: spencergibb

An InstanceRegisteredEvent is published as a Spring ApplicationEvent.

Comment From: YakovBurtsev

I met with some troubles. I have a eureka server:

@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication implements ApplicationListener<EurekaInstanceRegisteredEvent> {
    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }

    @Override
    public void onApplicationEvent(EurekaInstanceRegisteredEvent event) {
        System.out.println("got it!!!");
    }
}

And onApplicationEvent method doesn't work. But in console I see:

2017-02-10 12:40:29.946 INFO 14124 --- [nio-8761-exec-2] c.n.e.registry.AbstractInstanceRegistry : Registered instance SECONDSERVICE/SBT-SPB-IK4173.sigma.sbrf.ru:secondservice:8082 with status UP (replication=false) 2017-02-10 12:40:30.569 INFO 14124 --- [nio-8761-exec-3] c.n.e.registry.AbstractInstanceRegistry : Registered instance SECONDSERVICE/SBT-SPB-IK4173.sigma.sbrf.ru:secondservice:8082 with status UP (replication=true)

Why my listener doesn't work? Can you help me?

Comment From: spencergibb

That's a client side event, not server

Comment From: spring-projects-issues

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

Comment From: suryadip08

Hi @spencergibb ,

I did the same thing in client side but it didn't work too. Please help.

@SpringBootApplication
@ComponentScan(basePackages = { "com.xxx.network.inventory.oss.staticcontent", "com.xxx.commons.rest*"},
excludeFilters={
          @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=RestTemplateConfig.class)})
@EnableEurekaClient
public class OssUiApplication implements ApplicationListener<EurekaInstanceRegisteredEvent> {

    public static void main(String[] args) {
        SpringApplication.run(OssUiApplication.class, args);
    }

    @Override
    public void onApplicationEvent(EurekaInstanceRegisteredEvent event) {
        System.out.println("Got it...");
    }
}

Comment From: suryadip08

Hi @YakovBurtsev , Were you able to solve this issue because I am facing the same.