🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

How to keep message listener up and running to asynchronously keep receiving messages

rgundra
rgundra Member Posts: 1

Hi,
I am using JCSMP API. For listening to messages. I am using asynchronous receiving by implementing XMLMessageListener. Once I started FlowReceiver, it starts listening to messages, my program terminates after some time. I want my listener to be up and running until I terminate my program. Is it possible keep the listener up and running without a web container like tomcat. Please suggest on this.

Tagged:

Answers

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hi @rgundra, the FlowReceiver is an aynschronous, callback based object, so there's actually nothing going on in main. If you don't give main something to do, it will just complete and your application will terminate. Have you looked in the SolaceSamples Github repo? You can see the various approaches the samples take to this.