You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jamesilicious <ja...@dblue.co.uk> on 2013/05/30 20:23:05 UTC

[Best Practise Question] Seda + WireTap + Exchange ID : How to keep it all together?!

I've recently introduced Camel into a commercial project as a
proof-of-concept to see if we can use the framework. So far I'm really
enjoying Camel, and the community seems great. So enough gushing, whats my
question!

Scenario:
* We have a file route that is polling a directory
* When it finds a file, it makes an entry into a database
* The route then hands off to a seda endpoint to do the rest of the
processing
* The seda endpoint also does some database inserts through a wiretap

Problem
* We need a key to link together the database entries made by the file
route, and the seda route
* Initially we tried using the exchange id, but noticed that it changes when
seda picks up the request

Question
Is there a way of having the same exchange id when this hits the seda route?

The exchange Id is going to be used as a primary key (and FK). 

I'd thought about taking the exchange id from the first route and adding it
as a header to avoid it disappearing when passed to seda, but wanted a more
elegant solution if possible. The seda route also has a couple of wireTaps
that need to original exchange id too. 

Any thoughts?

Thanks in advance



--
View this message in context: http://camel.465427.n5.nabble.com/Best-Practise-Question-Seda-WireTap-Exchange-ID-How-to-keep-it-all-together-tp5733520.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Best Practise Question] Seda + WireTap + Exchange ID : How to keep it all together?!

Posted by jamesilicious <ja...@dblue.co.uk>.
Thanks - will give both of those a go!



--
View this message in context: http://camel.465427.n5.nabble.com/Best-Practise-Question-Seda-WireTap-Exchange-ID-How-to-keep-it-all-together-tp5733520p5734025.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Best Practise Question] Seda + WireTap + Exchange ID : How to keep it all together?!

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

When you use wire tap then the tapped exchange has its own unique exchange id.
But the wire tap will store the exchange id from its parent as a
"correlated exchange id".

You can get this id using java code:

String corId = exchange.getProperty(Exchange.CORRELATION_ID, String.class);


An alternative is to use the breadcrumbId which would be the same for
the original message and the wire tapped message.
You can read a bit here about that:

http://camel.apache.org/mdc-logging.html




On Thu, May 30, 2013 at 8:23 PM, jamesilicious <ja...@dblue.co.uk> wrote:
> I've recently introduced Camel into a commercial project as a
> proof-of-concept to see if we can use the framework. So far I'm really
> enjoying Camel, and the community seems great. So enough gushing, whats my
> question!
>
> Scenario:
> * We have a file route that is polling a directory
> * When it finds a file, it makes an entry into a database
> * The route then hands off to a seda endpoint to do the rest of the
> processing
> * The seda endpoint also does some database inserts through a wiretap
>
> Problem
> * We need a key to link together the database entries made by the file
> route, and the seda route
> * Initially we tried using the exchange id, but noticed that it changes when
> seda picks up the request
>
> Question
> Is there a way of having the same exchange id when this hits the seda route?
>
> The exchange Id is going to be used as a primary key (and FK).
>
> I'd thought about taking the exchange id from the first route and adding it
> as a header to avoid it disappearing when passed to seda, but wanted a more
> elegant solution if possible. The seda route also has a couple of wireTaps
> that need to original exchange id too.
>
> Any thoughts?
>
> Thanks in advance
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Best-Practise-Question-Seda-WireTap-Exchange-ID-How-to-keep-it-all-together-tp5733520.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen