You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ovidius <ov...@gmail.com> on 2008/10/20 09:22:00 UTC

Wait for condition

Hi,

I need a solution for the following problem: I have an endpoint (Seda),
which receives messages. In certain conditions have to wait an event before
process incoming messages.

What is the best solution?

Regards,
 Ovidiu.
-- 
View this message in context: http://www.nabble.com/Wait-for-condition-tp20064420s22882p20064420.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Wait for condition

Posted by James Strachan <ja...@gmail.com>.
2008/10/20 Ovidius <ov...@gmail.com>:
>
> Hi ,
>
>  I was a little evasive. I describe here the entire situation:
>
>     I Receive several messages in an endpoint. At some moment i have to
> suspend processing of messages (I do not know for how long so I can not use
> a delay which have to a specific duration) until it fulfills an external
> condition. When this condition fulfills i need to resume the processing of
> messages. During the  message processing is suspended other messages can
> arrive in the endpoind.

Another option is to add a bean processor into the route which can
implement the delay.

e.g.

from("seda:foo").bean(SomeClass.class).to("seda:output");

Then in your bean evaluate your specific condition and block until the
condition is met (either by checking the condition and then sleeping
and re-evaluating, or hopefully using some neater java.util.concurrent
mechanism to know when the condition is now met).

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

RE: Wait for condition

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

See CAMEL-1003 where I have attached a unit test that demonstrates how to stop and start a seda consumer from Java.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Claus Ibsen [mailto:ci@silverbullet.dk] 
Sent: 20. oktober 2008 14:57
To: camel-user@activemq.apache.org
Subject: RE: Wait for condition

Hi

I think you can use Java Code to start and stop the consumer. 

I am curious as well so I might hack together a sample tonight.

Otherwise the JMX console could be an easy test as well as you can invoke the start and stop command from it.





Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: raulvk [mailto:raulvk.soa@gmail.com] 
Sent: 20. oktober 2008 14:42
To: camel-user@activemq.apache.org
Subject: Re: Wait for condition

It occurs to me that perhaps you could look into using JMX to switch on and
switch off the processing.
Not very sure how you could go about it though, just my 2 cents.

2008/10/20 Ovidius <ov...@gmail.com>

>
> Hi ,
>
>  I was a little evasive. I describe here the entire situation:
>
>     I Receive several messages in an endpoint. At some moment i have to
> suspend processing of messages (I do not know for how long so I can not use
> a delay which have to a specific duration) until it fulfills an external
> condition. When this condition fulfills i need to resume the processing of
> messages. During the  message processing is suspended other messages can
> arrive in the endpoind.
>
> Best Regards,
>  Ovidiu.
> --
> View this message in context:
> http://www.nabble.com/Wait-for-condition-tp20064420s22882p20067465.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

RE: Wait for condition

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I think you can use Java Code to start and stop the consumer. 

I am curious as well so I might hack together a sample tonight.

Otherwise the JMX console could be an easy test as well as you can invoke the start and stop command from it.





Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: raulvk [mailto:raulvk.soa@gmail.com] 
Sent: 20. oktober 2008 14:42
To: camel-user@activemq.apache.org
Subject: Re: Wait for condition

It occurs to me that perhaps you could look into using JMX to switch on and
switch off the processing.
Not very sure how you could go about it though, just my 2 cents.

2008/10/20 Ovidius <ov...@gmail.com>

>
> Hi ,
>
>  I was a little evasive. I describe here the entire situation:
>
>     I Receive several messages in an endpoint. At some moment i have to
> suspend processing of messages (I do not know for how long so I can not use
> a delay which have to a specific duration) until it fulfills an external
> condition. When this condition fulfills i need to resume the processing of
> messages. During the  message processing is suspended other messages can
> arrive in the endpoind.
>
> Best Regards,
>  Ovidiu.
> --
> View this message in context:
> http://www.nabble.com/Wait-for-condition-tp20064420s22882p20067465.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: Wait for condition

Posted by raulvk <ra...@gmail.com>.
It occurs to me that perhaps you could look into using JMX to switch on and
switch off the processing.
Not very sure how you could go about it though, just my 2 cents.

2008/10/20 Ovidius <ov...@gmail.com>

>
> Hi ,
>
>  I was a little evasive. I describe here the entire situation:
>
>     I Receive several messages in an endpoint. At some moment i have to
> suspend processing of messages (I do not know for how long so I can not use
> a delay which have to a specific duration) until it fulfills an external
> condition. When this condition fulfills i need to resume the processing of
> messages. During the  message processing is suspended other messages can
> arrive in the endpoind.
>
> Best Regards,
>  Ovidiu.
> --
> View this message in context:
> http://www.nabble.com/Wait-for-condition-tp20064420s22882p20067465.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: Wait for condition

Posted by Ovidius <ov...@gmail.com>.
Hi ,
  	
 I was a little evasive. I describe here the entire situation:

     I Receive several messages in an endpoint. At some moment i have to
suspend processing of messages (I do not know for how long so I can not use
a delay which have to a specific duration) until it fulfills an external
condition. When this condition fulfills i need to resume the processing of
messages. During the  message processing is suspended other messages can
arrive in the endpoind.

Best Regards,
  Ovidiu.
-- 
View this message in context: http://www.nabble.com/Wait-for-condition-tp20064420s22882p20067465.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Wait for condition

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Does this condition only apply for certain exchanges? While others continuously should be processed normally?

For instance you can consume from the seda, test for the condition, if it should "wait" move the exchange to a different seda queue. Then all the other exchanges that "should not wait" can continue being processed normally.

Then on the other seda queue you can poll it when the "condition" is true.


Otherwise you can also just poll from the seda queue when the "condition" is true. You can use the Java API to pool it.
http://activemq.apache.org/camel/polling-consumer.html






Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: cmoulliard [mailto:cmoulliard@gmail.com] 
Sent: 20. oktober 2008 12:30
To: camel-user@activemq.apache.org
Subject: Re: Wait for condition


Hi Ovidiu,

Have you had a look to the "delayer pattern" -
http://activemq.apache.org/camel/delayer.html which allows you to delay the
delivery of messages to some destination ?

KR,

Charles Moulliard


Ovidius wrote:
> 
> Hi,
> 
> I need a solution for the following problem: I have an endpoint (Seda),
> which receives messages. In certain conditions have to wait an event
> before process incoming messages.
> 
> What is the best solution?
> 
> Regards,
>  Ovidiu.
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Wait-for-condition-tp20064420s22882p20066849.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Wait for condition

Posted by cmoulliard <cm...@gmail.com>.
Hi Ovidiu,

Have you had a look to the "delayer pattern" -
http://activemq.apache.org/camel/delayer.html which allows you to delay the
delivery of messages to some destination ?

KR,

Charles Moulliard


Ovidius wrote:
> 
> Hi,
> 
> I need a solution for the following problem: I have an endpoint (Seda),
> which receives messages. In certain conditions have to wait an event
> before process incoming messages.
> 
> What is the best solution?
> 
> Regards,
>  Ovidiu.
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Wait-for-condition-tp20064420s22882p20066849.html
Sent from the Camel - Users mailing list archive at Nabble.com.