On Mon, 17 Aug 2020 at 09:46, Gordon Sim <[email protected]> wrote:
>
> On 16/08/2020 6:24 pm, mohank wrote:
> >> Can you answer my question from before: Are you actually looking for
> >> your queue and address names to differ?
> >           No, I want to Send data to durable Queue with Filters.
> >
> >
> > Publisher code
> >                  char *FilterValue = 8;
> >                  Variant::Map content;
> >               content["myProperty"] = atoi(FilterValue );
> >               request.setProperties(content);
> >
> >               std::string data = "test";
> >               request.setContentBytes(data);
> >
> >               sender.send(request);
> >
> > At receiver end tried with the below address
> >
> >                sprintf(cAddress, "queue; {link:{filter:{name:jms-selector,
> > descriptor:'apache.org:selector-filter:string', value : 'myProperty=%s'}}}",
> > filterID);
> >
> >                Receiver receiver = session.createReceiver(cAddress);
> >
> > If the values matches, it consume the data else not.
> > not facing any multiple consumer issue But...
> >
> > above example is working for integer value, not working with string value.
> > Is there any modification I need to have string as a filter value ?
>
> You need the string to be quoted. So e.g.
>
> >   sprintf(cAddress, "queue; {link:{filter:{name:jms-selector, 
> > descriptor:'apache.org:selector-filter:string', value : 
> > \"myProperty='%s'\"}}}", filterID);
>
>
> > and can we have multiple filter value on single consumer?
>
> In theory you could but you can only have one JMS selector and I believe
> that is the only filter type the broker will recognise. However you can
> use AND/OR in the selector to combine different tests.
>

The 'string-literals-are-quoted', the use of AND / OR etc, and lots of
other selector syntax / details are covered in the "Message Selectors"
section at https://docs.oracle.com/javaee/7/api/javax/jms/Message.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to