'Can Spring Boot detect when the Google PubSub connection is down?

I've been googling and can't seem to find an answer to this question: Can a Spring Boot app get a lifecycle notification if its underlying broker connection (either Google PubSub or ActiveMQ, for example) is closed?

We're trying to monitor network status and one thing we thought we could use is the status of the Google PubSub connection; i.e., if it dies then we can assume the network is down and raise an alert.

But I can't seem to find an example of monitoring the state of an underlying connection. Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source