You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Vavricka <va...@gmail.com> on 2016/05/23 13:46:23 UTC

JMSMessageID filtering

Hi, 

  I am using JMS 1.0 client version 0.9.0 and Artemis server version 1.3.0.

  I am trying to filter incoming messages by creating selector when creating
Consumer.

  Message is created by:

Message msg = session.createMessage();

  MessageID is get by:

String messageID = msg.getJMSMessageID();
String JMSMessageID = messageID.substring(4, messageID.length() - 8);

ex: messageID = ID::4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26:1:1:1-1
     JMSMessageID = 4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26

  Message is successfully sent, then I create consumer by:

MessageConsumer receiver = session.createConsumer("test.queue",
"JMSMessageID = '" + JMSMessageID + "'");

  When selector is defined in createConsumer, message is not received. When
I remove selector, message is successfully received with id:
ID::4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26:1:1:1-1

I tried many messageID formats - with/without 'ID::' prefix, with/without
':1:1:1-1' suffix, etc.

Is this correct way how to filter MessageID ?

I suppose AMQP filtering is not supported (for example: amqp.message_id)? 

Regards,
Vavricka




--
View this message in context: http://activemq.2283324.n4.nabble.com/JMSMessageID-filtering-tp4712257.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: JMSMessageID filtering

Posted by Timothy Bish <ta...@gmail.com>.
On 05/24/2016 02:07 AM, Vavricka wrote:
> tabish121@gmail.com wrote
>> The broker won't be able to select on the MessageID as the AMQP message
>> ID is foreign to the broker and it must create its own internal instance
>> in order to properly function so the ID the client assigns wouldn't
>> match what the real broker side message has as its ID.
> Message is instance of javax.jms.Message. So the JMS Message ID and
> JMSMessageID selector is also foreign to the Artemis broker?

Not entirely sure how Artemis handles the message ID on the messages it 
receives so I can't say for sure if it will apply the JMS selector and 
get a match on the message IDs.

>
> The question regarding AMQP filtering was meant if AMQP selectors are
> supported (like amqp.message_id, amqp.creation_time)? It has nothing to do
> with JMS selectors (like JMSMessageID, JMSTimestamp).
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/JMSMessageID-filtering-tp4712257p4712297.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
ActiveMQ 5.x doesn't implement an AMQP based selector filter you would 
need to use the standard JMS message selector syntax and treat the 
messages as JMS messages so you'd select on  JMSTimeStamp etc, Artemis 
is the same as far as I know.

-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: JMSMessageID filtering

Posted by Vavricka <va...@gmail.com>.
tabish121@gmail.com wrote
> The broker won't be able to select on the MessageID as the AMQP message 
> ID is foreign to the broker and it must create its own internal instance 
> in order to properly function so the ID the client assigns wouldn't 
> match what the real broker side message has as its ID.

Message is instance of javax.jms.Message. So the JMS Message ID and
JMSMessageID selector is also foreign to the Artemis broker?

The question regarding AMQP filtering was meant if AMQP selectors are
supported (like amqp.message_id, amqp.creation_time)? It has nothing to do
with JMS selectors (like JMSMessageID, JMSTimestamp).



--
View this message in context: http://activemq.2283324.n4.nabble.com/JMSMessageID-filtering-tp4712257p4712297.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: JMSMessageID filtering

Posted by Timothy Bish <ta...@gmail.com>.
On 05/23/2016 09:46 AM, Vavricka wrote:
> Hi,
>
>    I am using JMS 1.0 client version 0.9.0 and Artemis server version 1.3.0.
>
>    I am trying to filter incoming messages by creating selector when creating
> Consumer.
>
>    Message is created by:
>
> Message msg = session.createMessage();
>
>    MessageID is get by:
>
> String messageID = msg.getJMSMessageID();
> String JMSMessageID = messageID.substring(4, messageID.length() - 8);
>
> ex: messageID = ID::4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26:1:1:1-1
>       JMSMessageID = 4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26
>
>    Message is successfully sent, then I create consumer by:
>
> MessageConsumer receiver = session.createConsumer("test.queue",
> "JMSMessageID = '" + JMSMessageID + "'");
>
>    When selector is defined in createConsumer, message is not received. When
> I remove selector, message is successfully received with id:
> ID::4a31cd43-d16a-4f5a-9e44-8b39b9e6ae26:1:1:1-1
>
> I tried many messageID formats - with/without 'ID::' prefix, with/without
> ':1:1:1-1' suffix, etc.
>
> Is this correct way how to filter MessageID ?
>
> I suppose AMQP filtering is not supported (for example: amqp.message_id)?
>
> Regards,
> Vavricka
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/JMSMessageID-filtering-tp4712257.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
The broker won't be able to select on the MessageID as the AMQP message 
ID is foreign to the broker and it must create its own internal instance 
in order to properly function so the ID the client assigns wouldn't 
match what the real broker side message has as its ID.

-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/