You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Müller <ch...@gmail.com> on 2013/03/01 01:57:34 UTC

Re: camel processor in InOut to send 2 replies

Will the following work for you (using Java DSL)?

from("jms:queue:data")
  .setHeader("id", constant("1"))
  .multicast()
    .inOnly("jms:queue:first", "jms:queue:second");

from("jms:queue:first")
  .to("bean:myMessageProcessor")
  .to("jms:queue:finished");

from("jms:queue:second")
  .to("bean:myMessageProcessor")
  .to("jms:queue:finished");

from("jms:queue:finished")
  .aggregate(header("id"), new YourAggregatingStrategy()).completionSize(2)
  .to("mock:dataresult");

Best,
Christian

On Wed, Feb 27, 2013 at 2:55 PM, Marco Crivellaro <ma...@gmail.com>wrote:

> Hi Hadrian,
> thanks for your reply. Sorry if I've been unclear.
> The messages I am publishing to the In queue have JMSReplyTo header set.
>
>
>  As you suggested I've used the reply to header to send an additional
> message using a bespoke producer in the process method of the Processor:
>
>
>         javax.jms.Destination replyTo =
> exchange.getIn().getHeader("JMSReplyTo", javax.jms.Destination.class);
>         JmsEndpoint replyEndpoint = new JmsEndpoint();
>         replyEndpoint.setDestination(replyTo);
>         DefaultProducerTemplate producer = (DefaultProducerTemplate)
> exchange.getContext().createProducerTemplate();
>
> producer.sendBodyAndHeaders(replyEndpoint.getEndpointUri().toString(),
> "TEST", exchange.getOut().getHeaders());
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-processor-in-InOut-to-send-2-replies-tp5728189p5728230.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--