camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Content Based Router
Date Tue, 21 Oct 2008 10:53:00 GMT
2008/10/21 selezovikj <semir.elezovic@gmail.com>:
>
> I have a camel route configuration in a camel-server.xml file:
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
>        <route>
>            <from uri="jms:topic:LoggingTopic"/>
>            <to uri="bean:msgParser"/>
>           <to uri="bean:contentRouter"/>
>        </route>
> </camelContext>
>
> In the contentRouter bean I want, when a certain condition is met to set a
> header like setHeader("action", "filterA"), which later I can use to perform
> routing logic.
>
> while ((strLine = br.readLine()) != null)   {
>        if(messageName.equals(strLine)){
>                   //SET HEADER or DIRECTLY ROUTE TO FILTER BEAN and then to
> FINAL BEAN
>
>        } else{
>
>                  //DIRECTLY ROUTE TO FINAL BEAN
>        }
>        in.close();
> }
>
> I am passing an object to this bean as far as I know. How can I make it
> relate to a message on which I can do setHeader ?

I don't really follow the question - do you wanna try rephrase that sentence?

You can use the Bean Binding so that when your bean is invoked you get
access to whatever in/out headers you want. Or you can just implement
the Processor interface and have the Exchange so you can play around
with headers/properties/payloads etc
http://activemq.apache.org/camel/bean-binding.html

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

Open Source Integration
http://fusesource.com/

Mime
View raw message