Sample: https://github.com/pertu/jms-sqs-actuator-health-sample Spring Boot: 2.4.0 AWS SQS JMS: 1.0.8 (latest as of 2020-12-04)

JmsHealthIndicator always shows UP for AWS SQS, even if SQS is not working (bad credentials, no network connection, etc).

In the sample app SQS throws:

com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain
    at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:131) ~[aws-java-sdk-core-1.11.106.jar:na]
    at ...

And JmsHealthIndicator shows:

{
  "status":"UP",
  "components":{
    "jms":{
      "status":"UP",
      "details": { "provider":"Amazon" }
    }
  }
}

My (shallow) analysis: JmsHealthIndicator checks health by doing connection.start(), which does not do anything in SQS provider, because it uses lazy initialization (no real connections are made until a request arrives).

Comment From: wilkinsona

Thanks for the report. In my opinion, that's a bug in the AWS SQS implementation of the JMS Connection interface. The javadoc for start states the following:

Starts (or restarts) a connection's delivery of incoming messages. A call to start on a connection that has already been started is ignored.

Throws: JMSException - if the Jakarta Messaging provider fails to start message delivery due to some internal error. See Also: javax.jms.Connection.stop

If the client cannot authenticate with SQS then message delivery cannot have been started so I don't think the Connection implementation complies with the contract. Can you please report this problem to Amazon? Without start behaving as expected, I don't think there's anything we can do to verify the health of the connection as we cannot send or receive a message as it may break the application.