Using selectors in exclusive queue

Options
mwis
mwis Member Posts: 3
edited January 25 in Blogs & Tutorials #1
Hi

I'm trying to use exclusive queue with many consumers with different selectors.
For some reason after starting application and providing consumers only first one stays active.

Used library is JCSMP.

var flowProps = new ConsumerFlowProperties();
flowProps.setEndpoint(queue);
flowProps.setAckMode(JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);
if (StringUtils.hasText(selector)) {
flowProps.setSelector(selector);
}
session.createFlow(listener, flowProps, endpointProperties);

Did I miss some configuration?

Used PubSub+ image: solace-pubsub-enterprise:10.4.1.59
JCSMP version: com.solacesystems:sol-jcsmp:10.3.1
Tagged:

Best Answer

  • Ragnar
    Ragnar Member, Employee Posts: 64 Solace Employee
    #2 Answer ✓
    Options

    Hi Mateusz,

    The description is exact as the key is 'subsequent consumers'. If you want 'concurrent consumers' you need to use a non-exclusive queue.

    Ragnar

Answers

  • uherbst
    uherbst Member, Employee Posts: 123 Solace Employee
    Options

    Hi @mwis, to understand your setup:

    You have ONE exclusive queue, you want to consume different messages (based on different selectors) from different consumers from this queue.

    Correct ?

    This wont work (as described), because only ONE consumer can consume from an exclusive queue at the same time. That is the meaning of "exclusive".
    Your setup will work, if you change the queue from "exclusive" to "non-exclusive".

    Uli

  • mwis
    mwis Member Posts: 3
    edited January 25 #4
    Options
    Hi @uherbst

    Yes, setup is correct.
    Documentation says something like this:

    Queue consumer
    When a consumer binds to an exclusive queue, the messages that it can consume are filtered by the selector defined for the consumer. The messages excluded by the consumer’s selector remain in the queue and can be consumed by subsequent consumers with different selectors or no selectors that might bind. Selectors act as egress filters on queues.

    From my point of view can be consumed means that it should work with different selectors (filters).

    Could you change description to be more exact on how it works if my understanding is incorrect?

    Mateusz
  • Ragnar
    Ragnar Member, Employee Posts: 64 Solace Employee
    #5 Answer ✓
    Options

    Hi Mateusz,

    The description is exact as the key is 'subsequent consumers'. If you want 'concurrent consumers' you need to use a non-exclusive queue.

    Ragnar

  • mwis
    mwis Member Posts: 3
    Options
    Hi,

    I missed that one word,

    thank you and Uli for answers.

    Have a good one!