Try PubSub+

JCSMP: Disconnect flow consumer from Queue to make possible other to connect

spyroidspyroid Member Posts: 6

Hi. I need to unbind flow consumer from queue to make possible to run other app for connecting to the same queue.


Best Answers

  • TomFTomF Member, Employee Posts: 182 Solace Employee
    Accepted Answer

    Hi @spyroid, well you can just call .close() on the flow (if you're using Java, for instance).
    Alternatively, if you don't need to worry about the order of the messages, you could change the queue type to "non-exclusive." This would allow multiple applications to read from the same queue at the same time - which of course means message ordering can't be guaranteed.

  • nramnram Member, Employee Posts: 7 Solace Employee
    edited January 13 Accepted Answer

    Hi @spyroid , you can call session.createFlow() multiple times and each time a new flow receiver with different FlowId will be created. These can be independently started/stopped and closed. With exclusive queue, the first flow receiver receives all the messages until it is closed. Then messages are sent to the next flow receiver and so on. With non-exclusive queue, as @TomF said, messages will be distributed across flow receivers.


  • spyroidspyroid Member Posts: 6
    edited January 12

    The queue is already configured to have only one subscriber. But how to start the subscriber on App1 again? I did tried to close() but got an error when was trying to start()

  • TomFTomF Member, Employee Posts: 182 Solace Employee

    @spyroid, ah, I think I see the problem. .close() destroys the flow - you need to re-create it and use that new flow going forward.

  • spyroidspyroid Member Posts: 6
    edited January 13

    Yes, the approach with creating Flow and close it is working. Thanks

  • TomFTomF Member, Employee Posts: 182 Solace Employee

    Glad to hear it @spyroid. If you're happy with the answer could you "accept" it? Thanks!

  • spyroidspyroid Member Posts: 6

    Sure I can, but I didn't see any button "Accept" :)

  • honghong Administrator Posts: 118 admin

    @spyroid I've changed the post from discussion to question. You can now click Yes to accept Tom's answer.

Sign In or Register to comment.