Regarding Connectivity status, Session status and Consumer status

mehdihasan
mehdihasan 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 ?

Tagged:

Comments

  • mehdihasan
    mehdihasan 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 ?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 954 admin
    edited July 2021 #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!

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 594 admin

    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.

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 954 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!

  • mehdihasan
    mehdihasan 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.

  • rishi_java
    rishi_java Member Posts: 9 ✭✭

    @mehdihasan

    Have you tried with Spring Boot Actuator  JmsHealthIndicator. In my spring boot I am using spring boot admin server and microservice which is consuming as client for admin.

    When I am starting the Monitoring server then consumer service starts creating new channel and close it instantly. And client id keep on repeating.

    without spring boot admin server it is working as expected( not creating any new JCSMP session or channel). I am creating java based configuration for connection factory.

    2023-04-20 22:28:39.056 INFO 53264 --- [nio-8093-exec-1] c.s.jcsmp.impl.JCSMPBasicSession     : Client-2: AdCtrl version changes: 2->4

    2023-04-20 22:28:39.058 INFO 53264 --- [nio-8093-exec-1] c.s.j.protocol.impl.TcpClientChannel   : Client-2: Connected to host 'orig=tcps://mr-cktpia96nor.messaging.solace.cloud:55443, scheme=tcps://, host=mr-cktpia96nor.messaging.solace.cloud, port=55443' (smfclient 2)

    2023-04-20 22:28:39.203 INFO 53264 --- [nio-8093-exec-1] c.s.j.protocol.impl.TcpClientChannel   : Client-2: Channel Closed (smfclient 2)

    2023-04-20 22:28:39.204 INFO 53264 --- [nio-8093-exec-1] c.s.jcsmp.protocol.smf.SSLSmfClient   : closeOutbound() : isSslDowngradeEnabled: false, mSslEngineClosed: false

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 954 admin

    Hi @rishi_java,

    Were you able to figure out your issue? If not, do you mind creating a new discussion for your question? That will get it on more folks radar. If you comment on an old thread only folks already on the thread will see it which is one of the reasons I also didn't see it until now. Also please include more of your config info to help us help you :)

  • rishi_java
    rishi_java Member Posts: 9 ✭✭

    @marc i have resolved that . Thankyou