camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen">
Subject RE: Content Based Router
Date Tue, 21 Oct 2008 10:54:52 GMT

You can use bean binding to add a 2nd paramter and annotate it as the @Headers

Public void myMethodInBean(@Headers Map headers, Object payload)

The bean binding is quite powerful. And had a rework on the wiki by James:

See this wiki for the annotations:

Or you can use the Exchange directly: (if not like annotations)
Public void myMethodInBean(Exchange exchange)

Med venlig hilsen
Claus Ibsen
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576

-----Original Message-----
From: selezovikj [] 
Sent: 21. oktober 2008 12:44
Subject: Content Based Router

I have a camel route configuration in a camel-server.xml file: 

<camelContext id="camel"
            <from uri="jms:topic:LoggingTopic"/>
            <to uri="bean:msgParser"/>
	   <to uri="bean:contentRouter"/>

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)   {
                   //SET HEADER or DIRECTLY ROUTE TO FILTER BEAN and then to
	} else{

                  //DIRECTLY ROUTE TO FINAL BEAN

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 ? Later this bean will just
return a message and I will have something like: 

<camelContext id="camel"
            <from uri="jms:topic:LoggingTopic"/>
            <to uri="bean:msgParser"/>
	   <to uri="bean:contentRouter"/>
            <from uri="bean:contentRouter"/>
        <xpath>$action = 'filterA'</xpath>
        <to uri="bean:filter"/>
        <to uri="bean:final/>

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message