camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: Polling Consumer and a Producer
Date Tue, 23 Oct 2012 19:33:20 GMT
If I understood you right, you want to send one message to a topic and
expect multiple responses which you want to aggregate. In this case, InOut
is not the right MEP.

What's about this:

from("...")
  .inOnly("activemq:topic:one.request");

from("activemq:topic:one.request?clientId=client_1&durableSubscriptionName=subscription_1")
  .process(...)
  .to("activemq:queue:one.response");

// some more clients if needed

from("activemq:topic:one.request?clientId=client_n&durableSubscriptionName=subscription_n")
  .process(...)
  .to("activemq:queue:one.response");

from("activemq:queue:one.response")
  .aggregate(header("id"), new
MyAggregatingStrategy()).completionTimeout(3000)
  .to("...");

Will this work for you?

Best,
Christian

On Sun, Oct 21, 2012 at 8:33 PM, zuff <bhtan1982@live.com> wrote:

> Hi Christian,
>
> From various examples I seen, most of the route looks like
>
>
> .
> <camelContext xmlns="http://camel.apache.org/schema/spring">
> <route>
>   <from uri="direct:start"/>
> <aggregate strategyRef="aggregatorStrategy" completionTimeout="3000">
> <correlationExpression>
> <simple>header.id</simple>
> </correlationExpression>
> <to uri="mock:aggregated"/>
> </aggregate>
> </route>
>
> As I very new to camel I'm not sure whether I interpret this correctly:
> This route is quite standalone without any relation to the other route.
>
>
> I need to link the first route to the second route.as I need to use the
> jmsreplyto
>
>
>
> But what I need is something like :
> <route>
>     <from uri="activemq:topic:request"/>
> <to uri="request:queue"/>
>  <to uri="direct:waitForQueue"/>
> </route>
>
> <route>
> <from uri="direct:waitForQueue"/>
>  <to uri="queueManager:queue?id={in.header.id}/>   [his portion will
> perform
> a polling and return the result that matches the given id']    <aggregate
> .................>         .....
>  </aggregate>
> </route>
>
> However my queueManager:queue is written as a polling consumer
> Therefore currently it only work if I do
> <from uri="queueManager:queue">
> Else I won't get the exchange generated by the receive() method
>
> Appreciate any advice.
> Where did I go wrong or how to redesign my route so that I could link
> router
> 1 and route 2.
> Able to use the polling consumer and the aggregate?
> If not, what else should I do?
> Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Polling-Consumer-and-a-Producer-tp5721274p5721349.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message