Try PubSub+

Regarding Connectivity status, Session status and Consumer status

mehdihasanmehdihasan Member Posts: 7

We are a consumer of couple of Solace queues.

We are consuming messages from (1) Kafka Connect framework using Solace PubSub Plus Source Connector, (2) Custom developed Spring Boot Application using Solace JMS API.

Case #1: issues with Solace PubSub Plus Source Connector
Sometimes we found that the connector is not listed in the management portal consumer list - which means the broker somehow kicked off the connector - so both are disconnected. But the Solace source connector still in RUNNING state. Which makes us confused. The connector has no connection with the Solace broker but still in running state - which makes no sense.
> Is there any way to identify if the Source Connector loose connection with the broker? Like change of state of the connector - failing the connector.

Case #2: Issues with SpringBoot consumer application
We also have some microservices developed in SpringBoot using Solace JMS api to consume messages from the broker queue. We wanted to develop a feature so that we can check the status of the connection, session and messageConsumer. But the default APIs are only stop/start/close. Nothing like , something like this.
> Is there is any way to check the status of the connection, session and messageConsumer ?

Comments

  • mehdihasanmehdihasan Member Posts: 7

    Case #2: Issues with SpringBoot consumer application

    We also have some microservices developed in SpringBoot using Solace JMS API to consume messages from the broker queue. We wanted to develop a feature so that we can check the status of the connection, session and messageConsumer. But the default APIs are only stop/start/close. Nothing like isConnected/isAlive, something like this.

    Is there is any way to check the status of the connection, session and messageConsumer ?

  • marcmarc Member, Administrator, Moderator, Employee Posts: 523 admin
    edited July 29 #4

    Hi @mehdihasan,

    re: "Case #2: Issues with SpringBoot consumer application" I'm checking with some folks internally to see if there are any tricks, but in general our JMS library implements the standard JMS API. I took a quick look and didn't see anything obvious to me. I noticed there is a isRunning() method available on the MessageListenerContainer, however I don't think that checks that status of the connection/session itself; just that the container was started. That said, in general I think most folks rely on Spring and the retry configurations to manage the connection, session, etc.

    Another couple of ideas here:
    1. I'd recommend checking out Spring Boot Actuator. It has a JmsHealthIndicator that you may consider using. It looks like that just creates a fresh connection to the broker though.
    2. You can of course also monitor things from the broker itself. If you assign your apps different client-usernames you can use the SEMP Monitor API to check what apps are currently connected among other details.
    3. You might also consider having your app send out heartbeat/health messages every X seconds. It can do an internal health check and report that it's healthy (or not). The absence of receiving that message would of course indicate an anomaly.

    Hope that helps!

  • AaronAaron Member, Moderator, Employee Posts: 281 Solace Employee

    The (Solace native) JCSMP API that the JMS API wraps around has various event callbacks that you can instantiate to get notifications of things happening inside the API. Some of these are exposed in JMS. See: https://docs.solace.com/API-Developer-Online-Ref-Documentation/jms/com/solacesystems/jms/SolConsumerEventListener.html

    https://docs.solace.com/API-Developer-Online-Ref-Documentation/jms/com/solacesystems/jms/SolConsumerEventSource.html

    a MessageConsumer created by the Solace JMS implementation can be cast to a SolConsumerEventSource

    So, not quite standard JMS, but one way to be notified what the app is doing.

    Of course, there's also the JMS Exception Listener, so make sure that's instantiated as well.

  • marcmarc Member, Administrator, Moderator, Employee Posts: 523 admin

    @mehdihasan,

    Is there any way to identify if the Source Connector loose connection with the broker? Like change of state of the connector - failing the connector.

    Assuming you're using this connector check out the troubleshooting section. If the app get's disconnected and reconnects you should see INFO (I think) level logs. You can see how to enable logs here

    Hope that helps!

  • mehdihasanmehdihasan Member Posts: 7

    Thanks a lot @marc and @Aaron. Great suggestions indeed. I will start working with those and will share my solution at the end so that others benefited from it.

Sign In or Register to comment.