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

**URL:** <https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550>\
**Category:** General Discussions\
**Tags:** queue, jcsmp\
**Created:** [January 12, 2021, 5:02pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550 "2021-01-12T17:02:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![spyroid](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/spyroid/32/147_2.png) [@spyroid](https://community.solace.com/u/spyroid)\
**Post date:** [January 12, 2021, 5:02pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/1 "2021-01-12T17:02:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TomF](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/tomf/32/1749_2.png) [@TomF](https://community.solace.com/u/TomF)\
**Post date:** [January 12, 2021, 8:06pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/2 "2021-01-12T20:06:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spyroid](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/spyroid/32/147_2.png) [@spyroid](https://community.solace.com/u/spyroid)\
**Post date:** [January 12, 2021, 9:19pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/3 "2021-01-12T21:19:11Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![nram](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/nram/32/742_2.png) [@nram](https://community.solace.com/u/nram)\
**Post date:** [January 13, 2021, 12:34am UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/4 "2021-01-13T00:34:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TomF](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/tomf/32/1749_2.png) [@TomF](https://community.solace.com/u/TomF)\
**Post date:** [January 13, 2021, 1:16pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/5 "2021-01-13T13:16:23Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![spyroid](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/spyroid/32/147_2.png) [@spyroid](https://community.solace.com/u/spyroid)\
**Post date:** [January 13, 2021, 3:09pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/6 "2021-01-13T15:09:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TomF](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/tomf/32/1749_2.png) [@TomF](https://community.solace.com/u/TomF)\
**Post date:** [January 13, 2021, 3:29pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/7 "2021-01-13T15:29:47Z")

</div>

Glad to hear it @spyroid. If you’re happy with the answer could you “accept” it? Thanks!

---

<div class="post-metadata">

**Author:** ![spyroid](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/spyroid/32/147_2.png) [@spyroid](https://community.solace.com/u/spyroid)\
**Post date:** [January 13, 2021, 3:41pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/8 "2021-01-13T15:41:31Z")

</div>

Sure I can, but I didn’t see any button “Accept” 🙂

---

<div class="post-metadata">

**Author:** ![hong](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/hong/32/1613_2.png) [@hong](https://community.solace.com/u/hong)\
**Post date:** [January 13, 2021, 3:49pm UTC](https://community.solace.com/t/jcsmp-disconnect-flow-consumer-from-queue-to-make-possible-other-to-connect/550/9 "2021-01-13T15:49:00Z")

</div>

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