You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "m.jimen.blazquez" <m....@gmail.com> on 2012/03/27 16:25:52 UTC

Have available data in several points of the route?

Hi,

I am evaluating if I can use CAMEL to implement workflows. I have read in
this same forum I can although CAMEL is not designed for it.

Anyway, I have been studying the different patters but the main problem I
find is that I don't know how to have data available in different points of
the route. What I am looking for is for something like the context in the
springwebflow technology, where it's you can  store any object and retrieve
it by its key.

Is this possible with CAMEL? 

kindest regards

--
View this message in context: http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598002.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Have available data in several points of the route?

Posted by Reuben Garrett <re...@gmail.com>.
On Wed, Mar 28, 2012 at 01:09, Christian Müller <christian.mueller@gmail.com
> wrote:

> claim-check is the prefered solution if you deal with big data.
>

... or security-sensitive/confidential data!  :]

~ Reuben

Re: Have available data in several points of the route?

Posted by Bilgin Ibryam <bi...@gmail.com>.
Thanks Christian.

I was wondering, what about if I need a context to store objects and access
them from a different  exchange (next on one the same route)? But probably
in this case the best option is to have context object in the Registry and
access registry from each exchange.  hhhmm

Bilgin

On 28 March 2012 07:09, Christian Müller <ch...@gmail.com>wrote:

> Yes, but
> - you can store your data as Exchange properties
> - you can use the enrich pattern [1] to enrich your message or message
> headers and use an AggregationStrategy to merge the old and the new
> Exchange together.
>
> claim-check is the prefered solution if you deal with big data.
>
> [1] http://camel.apache.org/content-enricher.html
> [2] http://camel.apache.org/aggregator2.html
>
> Best,
> Christian
>
> On Tue, Mar 27, 2012 at 5:39 PM, m.jimen.blazquez <
> m.jimen.blazquez@gmail.com> wrote:
>
> > Hi,
> >
> > Actually the exchange does not fit  because I have to interact with
> > services
> > which doesn't understand CAMEL so the body in exchange will always be the
> > returned object of the invoked method, won't it?
> >
> > best regards
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598178.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>

Re: Have available data in several points of the route?

Posted by Christian Müller <ch...@gmail.com>.
Yes, but
- you can store your data as Exchange properties
- you can use the enrich pattern [1] to enrich your message or message
headers and use an AggregationStrategy to merge the old and the new
Exchange together.

claim-check is the prefered solution if you deal with big data.

[1] http://camel.apache.org/content-enricher.html
[2] http://camel.apache.org/aggregator2.html

Best,
Christian

On Tue, Mar 27, 2012 at 5:39 PM, m.jimen.blazquez <
m.jimen.blazquez@gmail.com> wrote:

> Hi,
>
> Actually the exchange does not fit  because I have to interact with
> services
> which doesn't understand CAMEL so the body in exchange will always be the
> returned object of the invoked method, won't it?
>
> best regards
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598178.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Have available data in several points of the route?

Posted by Stefan Burkard <sb...@gmail.com>.
Actually there is no requirement that the called services know camel.

You can for example save the original message body to an exchange
property then convert the body to the needed "request object" that is
the parameter for the called service. Then the service response
replaces the message body again. Now you can use the response directly
or store it also in an exchange property and finally restore the
original message body by getting it from the initially saved exchange
property.

Pseudo code of such a route:

// save message body to exchange property to restore it later
.setProperty(SAVE_BODY, body())
// create service request parameter
.bean(typeConverter, "toServiceRequest")
// call searchService
.bean(serviceBean, "methodName")
// save service response to exchange property
.setProperty(RESPONSE, body())
// restore original message body
.setBody(property(SAVE_BODY))
continue with route ...



On Wed, Mar 28, 2012 at 01:25, Bilgin Ibryam <bi...@gmail.com> wrote:
> I think then you can use something like claim-check pattern
> http://camel.apache.org/claim-check.html to store and access your data from
> anywhere in the route.
>
> Bilgin
>
> On 27 March 2012 16:39, m.jimen.blazquez <m....@gmail.com> wrote:
>
>> Hi,
>>
>> Actually the exchange does not fit  because I have to interact with
>> services
>> which doesn't understand CAMEL so the body in exchange will always be the
>> returned object of the invoked method, won't it?
>>
>> best regards
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598178.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>

Re: Have available data in several points of the route?

Posted by Bilgin Ibryam <bi...@gmail.com>.
I think then you can use something like claim-check pattern
http://camel.apache.org/claim-check.html to store and access your data from
anywhere in the route.

Bilgin

On 27 March 2012 16:39, m.jimen.blazquez <m....@gmail.com> wrote:

> Hi,
>
> Actually the exchange does not fit  because I have to interact with
> services
> which doesn't understand CAMEL so the body in exchange will always be the
> returned object of the invoked method, won't it?
>
> best regards
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598178.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Have available data in several points of the route?

Posted by "m.jimen.blazquez" <m....@gmail.com>.
Hi,

Actually the exchange does not fit  because I have to interact with services
which doesn't understand CAMEL so the body in exchange will always be the
returned object of the invoked method, won't it?

best regards

--
View this message in context: http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598178.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Have available data in several points of the route?

Posted by Stefan Burkard <sb...@gmail.com>.
Hi

I think you are looking for the Camel Exchange. The Exchange is a
container that contains the messages (in-message and depending on the
MEP also out-message) as well as properties. You can put and get any
data into/from the properties of the exchange.

Regards
Stefan


On Tue, Mar 27, 2012 at 16:25, m.jimen.blazquez
<m....@gmail.com> wrote:
> Hi,
>
> I am evaluating if I can use CAMEL to implement workflows. I have read in
> this same forum I can although CAMEL is not designed for it.
>
> Anyway, I have been studying the different patters but the main problem I
> find is that I don't know how to have data available in different points of
> the route. What I am looking for is for something like the context in the
> springwebflow technology, where it's you can  store any object and retrieve
> it by its key.
>
> Is this possible with CAMEL?
>
> kindest regards
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Have-available-data-in-several-points-of-the-route-tp5598002p5598002.html
> Sent from the Camel - Users mailing list archive at Nabble.com.