I required to setup keepalive endpoint to may web application (tomcat war). The end point will be sampled periodically by my WAF to make sure that the app is healthy.
Healthy app means that the application is up and the communication to the RabbitMQ server (version 3.5.3 /spring-rabbit 1.4.5) is up and functional.
I will open some REST API to my WAF that will verify the connection status.
Reading the documentation I am quite lost on how to implement this functionally .
I noticed some functionality that may help, but I am not sure:
You don't need anything special like shovel to implement a health check. Just create a health queue and send/receive to/from it.
If you are using Spring AMQP
rabbitTemplate.send("", "healthQueue", "foo");
String foo = rabbitTemplate.receive("healthQueue");
In addition, you can register a ConnectionListener
with Spring AMQP's connection factory and you will be notified when the connection is created/closed.
Spring AMQP has had connection recovery from the beginning so the (relatively new) built-in auto recovery in the rabbitmq client is not used.
If you are not using Spring AMQP use basicPublish
and basicGet
on a channel to send/receive to/from a health queue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.