...
The aggregator EIP aggregates messages based on some message correlation criteria. In the Scala DSL, the aggregate
method takes a function Exchange ⇒ Any
to determine the correlation value for the exchange. In both samples the sample below, message are being aggregated if the first 7 letters in the message body are the same.
Wiki Markup |
---|
{snippet:id=simple|lang=java|url=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala} |
Wiki Markup |
{snippet:id=block|lang=java|url=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala} |
...
Wiki Markup |
---|
{snippet:id=simple|lang=java|url=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineAndMulticastTest.scala} |
...
Wiki Markup |
---|
{snippet:id=multicast|lang=java|url=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExplicitMulticastTest.scala} |
Recipient list
You can handle a static recipient list with a multicast or pipeline , but this EIP is usually applied when you want to dynamically determine the name(s) of the next endpoint(s) to route to. Use the recipients()
method with a function literal (Exchange => Any
) that returns the endpoint name(s). In the example below, the target endpoint name can be found in the String message starting at position 21.
...
Wiki Markup |
---|
{snippet:id=velocity|lang=java|url=camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ContentEnricherTest.scala} |
TODO
TODO: Create a Scala alternative and example for every EIP available
...