You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by pratibhaG <pr...@in2m.com> on 2008/07/03 13:56:42 UTC

getting in as well as out message at a time

I am using camel for routing a message like this:
from("jbi:service:http://servicemix.in2m.com/samples/http/jmsConsumer1")
	   
.to("jbi:service:http://servicemix.in2m.com/samples/http/MyProviderService?mep=in-out");

I want to get in as well as out message from MyProviderService at a time .
Is it possible to get it.?

I tried this:
from("jbi:service:http://servicemix.in2m.com/samples/http/jmsConsumer1")
	   
.to("jbi:service:http://servicemix.in2m.com/samples/http/MyProviderService?mep=in-out")
    
.to("jbi:service:http://servicemix.in2m.com/samples/http/beanProviderService2?mep=in-only");
  	
I tried to get messages in beanProviderService2 but I am not able to get the
in message to MyProviderService I only get out message. How can I get both?

Please help.

Pratibha

-- 
View this message in context: http://www.nabble.com/getting-in-as-well-as-out-message-at-a-time-tp18257600p18257600.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: getting in as well as out message at a time

Posted by Gert Vanthienen <ge...@skynet.be>.
Pratibha,

The route you're using is a pipeline -- it always sends the 'out' 
message from the previous hop along to the next one in the 'in' message, 
that's why you get the 'out' message from MyProviderService as the 'in' 
message in beanProviderService2.

If you want to get both of them, you need to write add intercept to your 
route:
        from("direct:a")
                  .intercept(new DelegateProcessor() {
                      public void process(Exchange exchange) throws 
Exception {
                          proceed(exchange);
                          System.out.println(exchange.getIn() + " -> " + 
exchange.getOut());
                      };
                  }).to("bean:ServiceBean?methodName=heavyLiftingLogic")

Here the delegate processor will first proceed with the Exchange, 
invoking the "bean:ServiceBean", and will regain control afterwards so 
it can print out both the in and out message.  You can use this to start 
a new Exchange with another endpoint, where you can send along both the 
in and out value -- just pack them together somehow and put them in your 
new Exchange's 'in' message.

Regards,

Gert

pratibhaG wrote:
> I am using camel for routing a message like this:
> from("jbi:service:http://servicemix.in2m.com/samples/http/jmsConsumer1")
> 	   
> .to("jbi:service:http://servicemix.in2m.com/samples/http/MyProviderService?mep=in-out");
>
> I want to get in as well as out message from MyProviderService at a time .
> Is it possible to get it.?
>
> I tried this:
> from("jbi:service:http://servicemix.in2m.com/samples/http/jmsConsumer1")
> 	   
> .to("jbi:service:http://servicemix.in2m.com/samples/http/MyProviderService?mep=in-out")
>     
> .to("jbi:service:http://servicemix.in2m.com/samples/http/beanProviderService2?mep=in-only");
>   	
> I tried to get messages in beanProviderService2 but I am not able to get the
> in message to MyProviderService I only get out message. How can I get both?
>
> Please help.
>
> Pratibha
>
>