You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michele <mi...@finconsgroup.com> on 2016/03/01 18:44:57 UTC

How to configure jms consumer with dynamic selector

Hi everyone,

How to configure selector option of jms consumer to retrieve messages with
date processed today -1?

Example:
from("jms:queue:for?selector=processDate=${date:now-1}").to("mock:result").

Process date in header.

Thanks in advance.

Greeting

Michele



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to configure jms consumer with dynamic selector

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You could also look into using a route policy, that keeps check on the
date, and when there is a date cross over, it stops the consumer,
change the jms selector, and starts it again.

Though haven't tried myself, but is maybe possible. The route policy
you would need some background thread etc to keep an eye on the
current date and what jms selector is in use, and if its not correct,
then do the change.

http://camel.apache.org/routepolicy

On Tue, Mar 1, 2016 at 9:27 PM, Michele
<mi...@finconsgroup.com> wrote:
> Hi Claus,
>
> thank you so mutch.
>
> Ok... I need to retrieve day+1 a outcome of a import flow of previous day.
>
> I thought to store outcome in jms queue and then retrieve it to create a
> file, but this is not possible for dynamic selector.
>
> Could I use a caching system (http://camel.apache.org/infinispan.html) to do
> the same thing? Or any suggestions?
>
> Thanks in advance.
>
> Greetings
>
> Michele
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492p5778494.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: How to configure jms consumer with dynamic selector

Posted by Michele <mi...@finconsgroup.com>.
Hi,

Thanks for your reply.

Aggregator with completion timeout is a good idea. I try it.
Can I use infinispan like a persistent repository?

Thanks in advance

Greetings
Michele





--
View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492p5778529.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to configure jms consumer with dynamic selector

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Maybe you could use an aggregator and set the completionTimeout to what you’re after?

You’d need to use a persistent store of some sort, but that may be a simple way to get what you’re after.

> On Mar 1, 2016, at 12:27 PM, Michele <mi...@finconsgroup.com> wrote:
> 
> Hi Claus,
> 
> thank you so mutch.
> 
> Ok... I need to retrieve day+1 a outcome of a import flow of previous day.
> 
> I thought to store outcome in jms queue and then retrieve it to create a
> file, but this is not possible for dynamic selector.
> 
> Could I use a caching system (http://camel.apache.org/infinispan.html) to do
> the same thing? Or any suggestions?
> 
> Thanks in advance.
> 
> Greetings
> 
> Michele
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492p5778494.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to configure jms consumer with dynamic selector

Posted by Michele <mi...@finconsgroup.com>.
Hi Claus,

thank you so mutch.

Ok... I need to retrieve day+1 a outcome of a import flow of previous day.

I thought to store outcome in jms queue and then retrieve it to create a
file, but this is not possible for dynamic selector.

Could I use a caching system (http://camel.apache.org/infinispan.html) to do
the same thing? Or any suggestions?

Thanks in advance.

Greetings

Michele



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492p5778494.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to configure jms consumer with dynamic selector

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

That is not possible afaik. The selector is a JMS selector and uses
the JMS selector syntax.

Also the selector is static and is created as part of the listener.

Though ActiveMQ for example provides some JMS selector extensions for xpath
http://activemq.apache.org/selectors.html

I dont think its possible to change the message selector dynamically

https://docs.oracle.com/javaee/7/api/javax/jms/QueueSession.html#createReceiver-javax.jms.Queue-java.lang.String-

On Tue, Mar 1, 2016 at 6:44 PM, Michele
<mi...@finconsgroup.com> wrote:
> Hi everyone,
>
> How to configure selector option of jms consumer to retrieve messages with
> date processed today -1?
>
> Example:
> from("jms:queue:for?selector=processDate=${date:now-1}").to("mock:result").
>
> Process date in header.
>
> Thanks in advance.
>
> Greeting
>
> Michele
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-jms-consumer-with-dynamic-selector-tp5778492.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2