I used JHipster to generate a several microservices based on Spring Cloud Netflix. Currently thinking about adding Spring AMQP support in one of the services, using this tutorial: https://spring.io/guides/gs/messaging-rabbitmq/
When adding the AMQP support in the services, I found the service always register with the Registry(Eureka) server with status DOWN, and if i remove following gradle dependency the problem will go away
compile('org.springframework.amqp:spring-rabbit:1.5.3.RELEASE')
The services with this dependency will first register with Eureka server with status UP at start up time, and then immediately re-register with status DOWN.
The logs of Eureka server:
2016-08-26 06:55:18.291 INFO 5875 --- [io-8761-exec-11] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status STARTING (replication=false) 2016-08-26 06:55:18.806 INFO 5875 --- [io-8761-exec-10] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status STARTING (replication=true) 2016-08-26 06:55:21.260 INFO 5875 --- [nio-8761-exec-8] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status STARTING (replication=false) 2016-08-26 06:55:21.763 INFO 5875 --- [nio-8761-exec-1] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status STARTING (replication=true) 2016-08-26 06:55:37.220 INFO 5875 --- [nio-8761-exec-3] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status UP (replication=false) 2016-08-26 06:55:37.730 INFO 5875 --- [nio-8761-exec-2] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status UP (replication=true) 2016-08-26 06:55:37.885 INFO 5875 --- [io-8761-exec-11] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status DOWN (replication=false) 2016-08-26 06:55:38.399 INFO 5875 --- [nio-8761-exec-5] c.n.e.registry.AbstractInstanceRegistry : Registered instance SALES/sales:4454c0adc6b9c70d799930ac3b7d374c with status DOWN (replication=true) 2016-08-26 06:55:43.699 INFO 5875 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 2ms 2016-08-26 06:56:43.700 INFO 5875 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 2ms
On the other side, the log of the Sales service does not have any errors. however comparing with other services which do not have amqp dependency, the most significant difference in the log is
2016-08-26 06:55:37.881 WARN 6440 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : Ignoring onDemand update due to rate limiter
I confirmed the issue will be fixed if i remove the spring amqp dependency.
Am I using the wrong amqp dependency? Is there any other way to use RabbitMQ in spring cloud microservices?