You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2023/03/31 09:28:20 UTC

ActiveMQ / Selector on message age

Hello.

We need to consume messages from some queues (using Camel JMS
component) only when messages are older than a given number of hours
or days.

I don't find any example of selector to filter messages this way.

Any help on that ?

Thanks in advance.

Regards.

Re: ActiveMQ / Selector on message age

Posted by Matt Pavlovich <ma...@gmail.com>.
Hi Ephemeris-

I think you’d want to reverse that logic.. 'JMSTimestamp <= 125252…'  <— this needs to be a long value of now() - 3600000 or whatever calculation you are looking for.

Selector examples: 

https://timjansen.github.io/jarfiller/guide/jms/selectors.xhtml

Thanks,
Matt Pavlovich

> On Mar 31, 2023, at 10:07 AM, Ephemeris Lappis <ep...@gmail.com> wrote:
> 
> Hello.
> 
> Have you any example of working selectors to compute the age from the
> JMSTimestamp, if it's possible, something like "JMSTimestamp + 3600000
>> now()" ?
> 
> Thanks again.
> 
> Regards.
> 
> Le ven. 31 mars 2023 à 16:43, Matt Pavlovich <ma...@gmail.com> a écrit :
>> 
>> Hello Ephemeris-
>> 
>> Yes, simply use the JMSTimestamp header as the field in your selector query.
>> 
>> Thanks,
>> -Matt
>> 
>>> On Mar 31, 2023, at 4:28 AM, Ephemeris Lappis <ep...@gmail.com> wrote:
>>> 
>>> Hello.
>>> 
>>> We need to consume messages from some queues (using Camel JMS
>>> component) only when messages are older than a given number of hours
>>> or days.
>>> 
>>> I don't find any example of selector to filter messages this way.
>>> 
>>> Any help on that ?
>>> 
>>> Thanks in advance.
>>> 
>>> Regards.
>> 


Re: ActiveMQ / Selector on message age

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

Have you any example of working selectors to compute the age from the
JMSTimestamp, if it's possible, something like "JMSTimestamp + 3600000
> now()" ?

Thanks again.

Regards.

Le ven. 31 mars 2023 à 16:43, Matt Pavlovich <ma...@gmail.com> a écrit :
>
> Hello Ephemeris-
>
> Yes, simply use the JMSTimestamp header as the field in your selector query.
>
> Thanks,
> -Matt
>
> > On Mar 31, 2023, at 4:28 AM, Ephemeris Lappis <ep...@gmail.com> wrote:
> >
> > Hello.
> >
> > We need to consume messages from some queues (using Camel JMS
> > component) only when messages are older than a given number of hours
> > or days.
> >
> > I don't find any example of selector to filter messages this way.
> >
> > Any help on that ?
> >
> > Thanks in advance.
> >
> > Regards.
>

Re: ActiveMQ / Selector on message age

Posted by Matt Pavlovich <ma...@gmail.com>.
Hello Ephemeris-

Yes, simply use the JMSTimestamp header as the field in your selector query.

Thanks,
-Matt

> On Mar 31, 2023, at 4:28 AM, Ephemeris Lappis <ep...@gmail.com> wrote:
> 
> Hello.
> 
> We need to consume messages from some queues (using Camel JMS
> component) only when messages are older than a given number of hours
> or days.
> 
> I don't find any example of selector to filter messages this way.
> 
> Any help on that ?
> 
> Thanks in advance.
> 
> Regards.