You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Mistroni <mm...@gmail.com> on 2012/08/23 22:12:07 UTC

JsonEndpoint and Router

hello all
 i have a camel-app in which i have configured a  Jetty endpoint which will
handle JSON requests/responses to my application.
this is the simple config data associated with it

<camel:route id="Jetty_Sample">
            <camel:from uri="jetty:http://localhost:8888/myJettyService" />
            <camel:process ref="myJettyService" />
            <camel:marshal ref="jsonFormatter" />
        </camel:route>

<bean id="jsonFormatter"
class="org.apache.camel.model.dataformat.JsonDataFormat">
        <property name="library" value="Jackson" />
    </bean>

I was wondering if there are any ways to use a router alongside with my
jetty endpoint......

Basically my jetty endpoint is the entry point to my applicatio for json
client. I am guessing the best way to use routing is to fetch one of the
json
parameter being sent, and based on that value, i'll forward the request to
another channel.......

is there anyone who had a similar usecase (having a json endpoint as an
'entry point' in a camel app)? if yes, how are you handling routing?

thanks in advance and regards
 marco

Re: JsonEndpoint and Router

Posted by Marco Mistroni <mm...@gmail.com>.
THanks a lot Yogesh,  that's exactly what i was looking for..

w/kindest regards
 marco

On Fri, Aug 24, 2012 at 2:54 AM, ychawla <pr...@yahoo.com>wrote:

> Hi Marco,
> I have had a similar situation.  I grab the JSON input, unmarshall to a
> POJO, inspect the payload for a parameter, and then set a camel header for
> routing.
>
> I have also had cases where I could route directly based of information in
> the HTTP Headers.
>
> Handling this by setting a header based on the input message seems like a
> good approach.
>
> Thanks,
> Yogesh
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JsonEndpoint-and-Router-tp5717969p5717972.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: JsonEndpoint and Router

Posted by ychawla <pr...@yahoo.com>.
Hi Marco,
I have had a similar situation.  I grab the JSON input, unmarshall to a
POJO, inspect the payload for a parameter, and then set a camel header for
routing.

I have also had cases where I could route directly based of information in
the HTTP Headers.  

Handling this by setting a header based on the input message seems like a
good approach.

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/JsonEndpoint-and-Router-tp5717969p5717972.html
Sent from the Camel - Users mailing list archive at Nabble.com.