You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Frank Schwarz <fs...@gmx.net> on 2009/04/19 22:41:17 UTC
Composed Message Processor
Hi,
I am trying to realize a composed message processor - without luck so far.
The messages get perfectly split, but I am not sure, how to realize the
aggregation later on.
Is there any built-in correlation criteria for the aggregation?
The documentation (http://camel.apache.org/splitter.html) says:
CamelSplitIndex: Camel 2.0: A split counter that increases for each Exchange
being split. The counter starts from 0.
How shall I read this line?
(a) For each composed message that is split, every item (that results from
the split) gets the _same_ value for the header "CamelSplitIndex". For the
next composed message to be split, this counter is increased by 1.
(b) For each split item from a composed message the header "CamelSplitIndex"
is increased by 1. With every new composed message to be split, this counter
start from 0.
I understand the documentation as (a) but what I observe is (b).
What is the correct reading? What is the intended behavior?
If (b), why does the splitter not insert a correlation header for the
aggregation later on?
Kind regards,
Frank
--
View this message in context: http://www.nabble.com/Composed-Message-Processor-tp23127178p23127178.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Composed Message Processor
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Apr 20, 2009 at 7:32 AM, Frank Schwarz <fs...@gmx.net> wrote:
>
> Hi Jon,
>
> thank you for the pointers.
>
> I did indeed have a look these pages, and I think there can be enhanced as
> well.
>
> If a beginner looks at this line:
> from("seda:aggregate").aggregate(new
> MyOrderAggregationStrategy()).header("orderId").to("mock:result");
>
> it is nowhere clear, what the header("orderId") refers to. Even in the
> source code of the unit test, you have to know where to look for.
>
> Please, see this a as a RFE.
Frank you have great findings in the documentation to some of the most
complex EIP patterns. That is great.
If you feel up to it its possible to get karma so you can edit the
wiki pages also:
http://camel.apache.org/support.html
>
> Please also consider enhancing the first user experience of the splitter
> component by adding a default correlation id, that can eventually be picked
> up (by default) by an aggregation component later on.
Good idea.
Its however best to submit RFE as a ticket in the JIRA tracker
Link to JIRA from here:
http://camel.apache.org/support.html
>
> -- Frank
>
>
>
>
> janstey wrote:
>>
>> FYI there are some docs on the composed message processor here
>> http://camel.apache.org/composed-message-processor.html
>>
>> as well as a unit test here
>> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java
>>
>> --
>> Cheers,
>> Jon
>>
>> http://janstey.blogspot.com/
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Composed-Message-Processor-tp23127178p23130624.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Re: Composed Message Processor
Posted by Frank Schwarz <fs...@gmx.net>.
Hi Jon,
thank you for the pointers.
I did indeed have a look these pages, and I think there can be enhanced as
well.
If a beginner looks at this line:
from("seda:aggregate").aggregate(new
MyOrderAggregationStrategy()).header("orderId").to("mock:result");
it is nowhere clear, what the header("orderId") refers to. Even in the
source code of the unit test, you have to know where to look for.
Please, see this a as a RFE.
Please also consider enhancing the first user experience of the splitter
component by adding a default correlation id, that can eventually be picked
up (by default) by an aggregation component later on.
-- Frank
janstey wrote:
>
> FYI there are some docs on the composed message processor here
> http://camel.apache.org/composed-message-processor.html
>
> as well as a unit test here
> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java
>
> --
> Cheers,
> Jon
>
> http://janstey.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/Composed-Message-Processor-tp23127178p23130624.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Composed Message Processor
Posted by Jon Anstey <ja...@gmail.com>.
FYI there are some docs on the composed message processor here
http://camel.apache.org/composed-message-processor.html
as well as a unit test here
http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java
On Sun, Apr 19, 2009 at 7:16 PM, Frank Schwarz <fs...@gmx.net> wrote:
>
> Hi Roman,
>
> thank you for the clarification.
>
> For the record, I realized the splitting this way, using the message-id
> from
> the original message as the aggregation-correlation-id:
>
> <route>
> <from uri="jms:queue:..." />
> <setHeader headerName="MyCorrelationId"><simple>id</simple></setHeader>
> <split>
> ...
> </split>
> </route>
>
> However, I think the documentation is incomplete and somewhat misleading at
> this point and should be corrected.
>
> Kind regards,
> Frank
>
>
>
> RomKal wrote:
> >
> > Intended behavior and the implemented one is (b)
> >
>
> --
> View this message in context:
> http://www.nabble.com/Composed-Message-Processor-tp23127178p23127659.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Cheers,
Jon
http://janstey.blogspot.com/
Re: Composed Message Processor
Posted by Frank Schwarz <fs...@gmx.net>.
Hi Roman,
thank you for the clarification.
For the record, I realized the splitting this way, using the message-id from
the original message as the aggregation-correlation-id:
<route>
<from uri="jms:queue:..." />
<setHeader headerName="MyCorrelationId"><simple>id</simple></setHeader>
<split>
...
</split>
</route>
However, I think the documentation is incomplete and somewhat misleading at
this point and should be corrected.
Kind regards,
Frank
RomKal wrote:
>
> Intended behavior and the implemented one is (b)
>
--
View this message in context: http://www.nabble.com/Composed-Message-Processor-tp23127178p23127659.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Composed Message Processor
Posted by Roman Kalukiewicz <ro...@gmail.com>.
2009/4/19 Frank Schwarz <fs...@gmx.net>:
>
> Hi,
>
> I am trying to realize a composed message processor - without luck so far.
>
> The messages get perfectly split, but I am not sure, how to realize the
> aggregation later on.
>
> Is there any built-in correlation criteria for the aggregation?
>
> The documentation (http://camel.apache.org/splitter.html) says:
> CamelSplitIndex: Camel 2.0: A split counter that increases for each Exchange
> being split. The counter starts from 0.
>
> How shall I read this line?
> (a) For each composed message that is split, every item (that results from
> the split) gets the _same_ value for the header "CamelSplitIndex". For the
> next composed message to be split, this counter is increased by 1.
> (b) For each split item from a composed message the header "CamelSplitIndex"
> is increased by 1. With every new composed message to be split, this counter
> start from 0.
>
> I understand the documentation as (a) but what I observe is (b).
>
> What is the correct reading? What is the intended behavior?
Intended behavior and the implemented one is (b)
> If (b), why does the splitter not insert a correlation header for the
> aggregation later on?
There is no correlation header, because if you want to aggregate split
messages back, then splitter has a built in aggregator, that simply
aggregates parts that it sent - there is no reason for additional
correlation id when it knows identities of those exchanges. Of course
it means that splitter works in in-out mode and you provided
aggregation strategy.
Of course you can provide your own correlation id for some future
aggregation of those messages, but this is your choice, so you provide
your own way of correlation. Camel doesn't force you to aggregate
things the same way as they were split.
For details of usage refer to
http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
I hope my explanation helps a little,
Roman