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: 405 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.