Kal,
from("activemq:queue:myQueue") would typically create a message driven consumer. I think you are on the right track with thoughts on polled endpoints. I you are looking to consume messages when a state changes, you could generate application events when that happens and use a pollEnrich(...) eip. Something like: from("spring-event://default").pollEnrich("activemq:queue:foo").process(...)... You could use a timer endpoint instead of an application event if you want to poll based on a schedule. Check out: http://camel.apache.org/polling-consumer.html http://camel.apache.org/content-enricher.html (pollEnrich section) Of course there are other ways to activate the polling: Camel Proxy Bean (to send to direct endpoints from pojos) Camel Consumer Template Hope this helps. Good luck. Mathieu ---------------------------------------- > Date: Thu, 1 Sep 2011 16:57:08 -0700 > From: kalpi...@cisco.com > To: users@camel.apache.org > Subject: Re: Activemq dynamic endpoint configuration > > Ashwin, > > Thanks, I agree this is a bad approach. I am a bit confused about how > often configure() method is invoked and when the message would be read from > the queue. For Example: > > public class TestRouteBuilder extends RouteBuilder { > > public String current_State = "process"; > > @Override > public void configure() throws Exception { > > String selector = generateSelectorURI(current_state); > > from("activemq:queue:test?selector="+selector) > .to("log:test") > .process(new Processor() { > > @Override > public void process(Exchange exchange) throws Exception { > > current_State="waiting"; > sendSoapRequest("test"); > } > }); > } > } > > I only want to read and process messages if current_state is “process” ( so > in "waiting" state change selector value so none of the messages would be > read). > > What type of endpoint would camel create based on > “from(“activemq:queue..”)” ? ex: polled or scheduled endpoint. > > Would the selector uri get re-created on every read? does camel just change > endpoint configuration or re-create a new endpoint ? > > If you have a good example on how to do dynamic selector with > camel/activemq, I would love to see it. > > I really appreciate all your help. > > Thanks > Kal > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Activemq-dynamic-endpoint-configuration-tp4749853p4760387.html > Sent from the Camel - Users mailing list archive at Nabble.com.