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: Reply messages from aggregator
Date Sun, 10 Mar 2013 01:53:49 GMT
Can you explain in more detail what you want to do? I didn't understand
your requirement...
One question: Your "aggregation" object implements Predicate *AND*
AggregationStrategy?

By looking a your example, your direct endpoint receives (String/Byte
array/...) messages and convert it into a JAXB annotated Java Object. You
aggregate all messages based on the "MSG/MID" element until your
aggregation predicate indicates the end. Afterwards you send the aggregated
messages to another direct endpoint.
*IF* you want to send back a message at the time it receives in the
aggregator, I would do something like this

from("direct:atsm-segment")
  .unmarshal(jaxb)
  .inOnly("seda:aggregator")
  .inOut("bean:myResponseBuilder")
  .marshal(jaxb);

from("seda:aggregator")
  .aggregate(xpath("/MSG/MID"),
aggregation).completionPredicate(aggregation)
  .to("direct:atsm-out");

Best,
Christian

On Fri, Mar 1, 2013 at 2:29 PM, Sven Bauhan <sven.bauhan@ast.dfs.de> wrote:

> Hi,
>
> I'm quite new to Camel and I have a problem to understand the basic
> principle of sending replys back to a sender.
> I try to implement a protocol that aggregates segments to a complete
> message. For each segment a reply message is expected by the sender.
> My route is now:
>
>         JaxbDataFormat jaxb = new JaxbDataFormat();
>         ATSMAggregationStrategy aggregation = new
> ATSMAggregationStrategy();
>         from("direct:atsm-segment")
>             .unmarshal(jaxb).aggregate(**xpath("/MSG/MID"), aggregation)
>             .completionPredicate(**aggregation).to("direct:atsm-**out");
>
> Do I have to set the exchange pattern of the aggregator to InOut? How can
> I do this?
> How is the reply message defined? Do I have to set the out message in the
> aggregation strategy?
> How do I trigger sending of a reply message?
> How is the reply messages routed back to the sender?
> Is the reply messages processed automatically (JAXB)?
>
> Thanks,
> Sven Bauhan
>
>


--

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