You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "maxence.dewil" <th...@gmail.com> on 2012/11/26 09:17:12 UTC
inOnly and original MEP
Hi,
I need some clarification for inOnly(String uri): the documentation states
''Notice the existing MEP is restored after the message has been sent to the
given endpoint."
However with the route below, I loose my original 'Input' object:
from("direct:myRoute")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(new Input()));
}
})
.inOnly("direct:eventRoute")
And if I change the route to this:
from("direct:myRoute")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(new Input()));
}
})
.inOnly("seda:eventRoute")
Then my 'Input' object is available in exchange.getOut().getBody()
Thank
--
View this message in context: http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: inOnly and original MEP
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Nov 26, 2012 at 9:17 AM, maxence.dewil <th...@gmail.com> wrote:
> Hi,
>
> I need some clarification for inOnly(String uri): the documentation states
> ''Notice the existing MEP is restored after the message has been sent to the
> given endpoint."
>
> However with the route below, I loose my original 'Input' object:
>
> from("direct:myRoute")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setBody(new Input()));
> }
> })
> .inOnly("direct:eventRoute")
>
This is because you use the direct component which is a synchronous
method call.
And in your eventRoute you may alter the message, which gets reflected.
> And if I change the route to this:
>
> from("direct:myRoute")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setBody(new Input()));
> }
> })
> .inOnly("seda:eventRoute")
>
> Then my 'Input' object is available in exchange.getOut().getBody()
>
As you call a async component, seda. Then it copies a message to the
seda queue, and continues processing.
See
http://camel.apache.org/event-message.html
http://camel.apache.org/direct
http://camel.apache.org/seda
> Thank
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
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
Re: inOnly and original MEP
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Nov 26, 2012 at 11:50 AM, maxence.dewil <th...@gmail.com> wrote:
> Charles Moulliard-2 wrote
>> Question : Do you send the message (= event) without taking care about the
>> response or are you expecting the response ?
>
> Indeed we don't care about the response. It's just an event we send.
>
See this EIP then
http://camel.apache.org/wire-tap.html
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219p5723228.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
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
Re: inOnly and original MEP
Posted by "maxence.dewil" <th...@gmail.com>.
Charles Moulliard-2 wrote
> Question : Do you send the message (= event) without taking care about the
> response or are you expecting the response ?
Indeed we don't care about the response. It's just an event we send.
--
View this message in context: http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219p5723228.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: inOnly and original MEP
Posted by Charles Moulliard <ch...@gmail.com>.
If you would like to send the same original message to several endpoints (=
other systems), then you use the multicast EIP pattern (
http://camel.apache.org/multicast.html) which will copy for the message to
the destination endpoints.
Question : Do you send the message (= event) without taking care about the
response or are you expecting the response ?
On Mon, Nov 26, 2012 at 11:35 AM, maxence.dewil <th...@gmail.com>wrote:
> Thank you for your responses.
>
> What I'm trying to implement is a main route that sends synchronous events
> to other systems (= direct:eventRoute).
>
> So if I understand well, to implement this pattern, each time I send an
> event, I have to:
> - copy the original body in a property or header
> - send the event
> - restore the original body from the property or header
> - set it as route output
> - clear the property or header
>
> Am I right ?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219p5723226.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
Re: inOnly and original MEP
Posted by "maxence.dewil" <th...@gmail.com>.
Thank you for your responses.
What I'm trying to implement is a main route that sends synchronous events
to other systems (= direct:eventRoute).
So if I understand well, to implement this pattern, each time I send an
event, I have to:
- copy the original body in a property or header
- send the event
- restore the original body from the property or header
- set it as route output
- clear the property or header
Am I right ?
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219p5723226.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: inOnly and original MEP
Posted by Charles Moulliard <ch...@gmail.com>.
Maxence,
The In object is only used in an InOnly exchange and Out when a response
must be propagated back to the from() component. If you would like that
your route exposed behind the endpoint "direct:eventRoute" or "seda:eventRoute"
return a response, then you should define the setExchangePattern as InOut (
http://camel.apache.org/exchange-pattern.html)
Regards,
On Mon, Nov 26, 2012 at 9:17 AM, maxence.dewil <th...@gmail.com> wrote:
> Hi,
>
> I need some clarification for inOnly(String uri): the documentation states
> ''Notice the existing MEP is restored after the message has been sent to
> the
> given endpoint."
>
> However with the route below, I loose my original 'Input' object:
>
> from("direct:myRoute")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setBody(new Input()));
> }
> })
> .inOnly("direct:eventRoute")
>
> And if I change the route to this:
>
> from("direct:myRoute")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setBody(new Input()));
> }
> })
> .inOnly("seda:eventRoute")
>
> Then my 'Input' object is available in exchange.getOut().getBody()
>
> Thank
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/inOnly-and-original-MEP-tp5723219.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com