camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Activemq dynamic endpoint configuration
Date Wed, 28 Sep 2011 06:00:09 GMT
Hi

Yes you would need to stop the route. Adjust the endpoint. And start
the route again to have the JMS selector dynamic updated.

CamelContext has API to start/stop rotues by the route id.


On Wed, Sep 28, 2011 at 5:10 AM, kal2420 <kalpipat@cisco.com> wrote:
> Thanks Claus,
>
>    This example is very helpful, I am still running into a bit of an issues. Here is
my createRouteBuilder() method ( combined JmsSelectorTest and JmsSelectorInTest ) :
>
>   @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            @Override
>            public void configure() throws Exception {
>                JmsEndpoint endpoint = context.getEndpoint("activemq:test.b",
JmsEndpoint.class);
>                endpoint.setSelector("selector=cheese='y'");
>
>                from("activemq:test.a").to("activemq:test.b");
>
>                // from("activemq:test.b?selector=cheese='y'").to("mock:result");
>                from(endpoint).routeId("route-b").to("mock:result");
>
>                from("activemq:test.c").process(new Processor() {
>
>                    @Override
>                    public void process(Exchange arg0) throws Exception {
>
>                        //==================================================
>                        //
>                        //      I want to change selector on an endpoint
at run time
>                        //       does it require an endpoint restart ?
>                        //==================================================
>
>                        CamelContext ctx = getContext();
>                        Route rt = ctx.getRoute("route-b");
>                        JmsEndpoint endpoint = (JmsEndpoint) rt.getEndpoint();
>                        endpoint.setSelector("cheese IN ('x', 'n')");
>
>                    }
>                }).to("activemq:test.b");
>            }
>        };
>    }
>
>
> I noticed that if I define the selector as part of the uri every thing works, but I want
to dynamically change the selector at runtime.  Let me know if I am doing something wrong
here.
>
> Thanks
> Kal
>
> On Sep 27, 2011, at 8:09 AM, Claus Ibsen-2 [via Camel] wrote:
>
>> Hi
>>
>> I created an unit test which you can take a look at. It uses the IN selector
>> http://svn.apache.org/viewvc?rev=1176348&view=rev
>>
>> On Tue, Sep 27, 2011 at 1:58 PM, Claus Ibsen <[hidden email]> wrote:
>>
>> > On Mon, Sep 26, 2011 at 6:05 PM, kal2420 <[hidden email]> wrote:
>> >> Thanks Claus,
>> >>
>> >>     I got busy with work, and I am just getting back to camel. I did try
>> >> looking into event-driven-consusmer, What i really want is to configure
>> >> dynamic selector on activemq queue. Here is how I am trying to configure
>> >> dynamic selector, please tell me if this is correct:
>> >>
>> >> // once all routes are up and running
>> >> // set selector on jms endpoint
>> >> CamelContext ctx = getContext();
>> >> JmsEndpoint endpoint =
>> >> ctx.getEndpoint("activemq://queue:test-1",JmsEndpoint.class);
>> >>  // String selector = "userid='test12'";  // also tried with %3D url format
>> >> String selector = "userid IN ('test12' , 'terst234');
>> >>  endpoint.setSelector(selector);
>> >>
>> >
>> > So you have a route with that particular endpoint
>> > from(endpoint).to("xxx")
>> >
>> >
>> > The selector should use a SQL like syntax. I actually do not know if
>> > ActiveMQ has an logging to WARN/ERROR level
>> > if the syntax is invalid.
>> >
>> >
>> >
>> >> Issue:  I am seeing all messages being processed, while i only want to
>> >> process messages where i have userid header value set to 'test12' or
>> >> 'terst234'
>> >>
>> >> Thanks
>> >> Kal
>> >>
>> >> --
>> >> View this message in context: http://camel.465427.n5.nabble.com/Activemq-dynamic-endpoint-configuration-tp4749853p4841926.html
>> >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> > --
>> > Claus Ibsen
>> > -----------------
>> > FuseSource
>> > Email: [hidden email]
>> > Web: http://fusesource.com
>> > Twitter: davsclaus, fusenews
>> > Blog: http://davsclaus.blogspot.com/
>> > Author of Camel in Action: http://www.manning.com/ibsen/
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>> If you reply to this email, your message will be added to the discussion below:
>> http://camel.465427.n5.nabble.com/Activemq-dynamic-endpoint-configuration-tp4749853p4845119.html
>> To unsubscribe from Activemq dynamic endpoint configuration, click here.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Activemq-dynamic-endpoint-configuration-tp4749853p4847785.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message