Actuator health check for SQS Listener Container #528
-
I am using the SQS messaging features in Spring Cloud AWS (version 3.0.0-M2).
and SqsListenerContainerFactory bean as below
I would like to create a custom actuator Note: My requirement is same as the one mentioned here : spring-attic/spring-cloud-aws#317 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
Hi @jubinjacobthomas, thanks for looking into this. You can inject / lookup the If your use case is just making sure all queues are present / accessible at startup, you can set I'm not sure if it's worth it just checking if all containers are running, as currently the only way to stop a container is manually or on application shutdown. Would it be worth it adding an Please let us know if this works for you! |
Beta Was this translation helpful? Give feedback.
-
Hi @tomazfernandes, Thanks for your suggestion. The idea here is to create a healthcheck endpoint using actuator which our infrastructure(Kubernetes) can use to restart the app if the sqs listeners get stopped due to any error. Based on your suggestion I came up with this
|
Beta Was this translation helpful? Give feedback.
-
Well, as I mentioned, this should never return false unless users stop the container manually, or the application is shutting down. Currently the only error that can stop the container is InterruptedException, and it doesn’t change the running status to false. AFAIK, since users don’t have access to the container thread, the only way the thread can be interrupted is at application shutdown, so the running flag will have been set to false already. Maybe I’m missing something? Anyway, you can give it a try and let us know how it works out! |
Beta Was this translation helpful? Give feedback.
Hi @jubinjacobthomas, thanks for looking into this.
You can inject / lookup the
MessageListenerContainerRegistry
bean, which has methods to retrieve all or an individual container:spring-cloud-aws/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/MessageListenerContainerRegistry.java
Lines 22 to 52 in 57737cf