You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Oliver Jelinski (JIRA)" <ji...@apache.org> on 2011/02/17 13:01:29 UTC

[jira] Created: (CAMEL-3677) When splitting inside another split, the custom aggregationStrategy is not used.

When splitting inside another split, the custom aggregationStrategy is not used.
--------------------------------------------------------------------------------

                 Key: CAMEL-3677
                 URL: https://issues.apache.org/jira/browse/CAMEL-3677
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.5.0
         Environment: Mac OS X 10.6.6, Eclipse Helios
            Reporter: Oliver Jelinski
            Priority: Minor


When splitting inside another split, the custom aggregationStrategy is not used. For example in the route:

{code:xml}
	    <route id="DoubleSplitRoute">
	    	<from uri="direct:in" />
	    	<setBody>
	    		<constant>
&lt;a&gt;
	&lt;b&gt;
		&lt;c&gt;Hello&lt;/c&gt;
		&lt;c&gt;World&lt;/c&gt;
	&lt;/b&gt;
	&lt;b&gt;
		&lt;c&gt;Hello&lt;/c&gt;
		&lt;c&gt;again&lt;/c&gt;
	&lt;/b&gt;
&lt;/a&gt;
	    		</constant>
	    	</setBody>
			<split>
				<xpath>a/b</xpath>
				<split strategyRef="concatWithSpaceStrategy">
					<xpath>b/c/text()</xpath>
					<setBody><simple>${bodyAs(java.lang.String)}</simple></setBody>
					<log message="Got a part: ${body}"/>
				</split>
				<log message="Got a result: ${body}"/>
			</split>
		</route>
{code}

(where the {{concatWithSpaceStrategy}} does nothing more than to concat the bodies with a space inbetween.)

The expected results would be:

{code}
Got a result: Hello World
{code}

and 

{code}
Got a result: Hello again
{code}

But that is not what happens. The actual results are two times the same:

{code}
Got a result: 
<a>
	<b>
		<c>Hello</c>
		<c>World</c>
	</b>
	<b>
		<c>Hello</c>
		<c>again</c>
	</b>
</a>
{code}

The reason is, that the strategy is not used. In the class {{org.apache.camel.processor.MulticastProcessor}}, in the method {{protected AggregationStrategy getAggregationStrategy(Exchange exchange)}}, the first step is to find an aggregationStrategy in the Exchange. This is set to {{UseOriginalAggregationStrategy}}, and because it is not null, this aggregation strategy will be used, not the one declared for the splitter.

---

A workaround would be to remove the AggregationStrategy of the Exchange, before it is aggregated, by using a processor with the following process method:

{code:java}
	public void process(Exchange exchange) throws Exception {
		if (exchange != null) {
			exchange.removeProperty(Exchange.AGGREGATION_STRATEGY);
		}
	}
{code}

After integrating this in my route, I got the desired results.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (CAMEL-3677) When splitting inside another split, the custom aggregationStrategy is not used.

Posted by "Oliver Jelinski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Jelinski updated CAMEL-3677:
-----------------------------------

    Fix Version/s: 2.6.0

> When splitting inside another split, the custom aggregationStrategy is not used.
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3677
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>         Environment: Mac OS X 10.6.6, Eclipse Helios
>            Reporter: Oliver Jelinski
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> When splitting inside another split, the custom aggregationStrategy is not used. For example in the route:
> {code:xml}
> 	    <route id="DoubleSplitRoute">
> 	    	<from uri="direct:in" />
> 	    	<setBody>
> 	    		<constant>
> &lt;a&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;World&lt;/c&gt;
> 	&lt;/b&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;again&lt;/c&gt;
> 	&lt;/b&gt;
> &lt;/a&gt;
> 	    		</constant>
> 	    	</setBody>
> 			<split>
> 				<xpath>a/b</xpath>
> 				<split strategyRef="concatWithSpaceStrategy">
> 					<xpath>b/c/text()</xpath>
> 					<setBody><simple>${bodyAs(java.lang.String)}</simple></setBody>
> 					<log message="Got a part: ${body}"/>
> 				</split>
> 				<log message="Got a result: ${body}"/>
> 			</split>
> 		</route>
> {code}
> (where the {{concatWithSpaceStrategy}} does nothing more than to concat the bodies with a space inbetween.)
> The expected results would be:
> {code}
> Got a result: Hello World
> {code}
> and 
> {code}
> Got a result: Hello again
> {code}
> But that is not what happens. The actual results are two times the same:
> {code}
> Got a result: 
> <a>
> 	<b>
> 		<c>Hello</c>
> 		<c>World</c>
> 	</b>
> 	<b>
> 		<c>Hello</c>
> 		<c>again</c>
> 	</b>
> </a>
> {code}
> The reason is, that the strategy is not used. In the class {{org.apache.camel.processor.MulticastProcessor}}, in the method {{protected AggregationStrategy getAggregationStrategy(Exchange exchange)}}, the first step is to find an aggregationStrategy in the Exchange. This is set to {{UseOriginalAggregationStrategy}}, and because it is not null, this aggregation strategy will be used, not the one declared for the splitter.
> ---
> A workaround would be to remove the AggregationStrategy of the Exchange, before it is aggregated, by using a processor with the following process method:
> {code:java}
> 	public void process(Exchange exchange) throws Exception {
> 		if (exchange != null) {
> 			exchange.removeProperty(Exchange.AGGREGATION_STRATEGY);
> 		}
> 	}
> {code}
> After integrating this in my route, I got the desired results.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CAMEL-3677) When splitting inside another split, the custom aggregationStrategy is not used.

Posted by "Oliver Jelinski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995790#comment-12995790 ] 

Oliver Jelinski commented on CAMEL-3677:
----------------------------------------

Yes, sorry, I didn't use 2.6 yet, because I had different issues, and I didn't find the bug reported, so I didn't think it would have been fixed yet. But: yes! You fixed it in 2.6. My routes are working correct without my workaround.

> When splitting inside another split, the custom aggregationStrategy is not used.
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3677
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>         Environment: Mac OS X 10.6.6, Eclipse Helios
>            Reporter: Oliver Jelinski
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> When splitting inside another split, the custom aggregationStrategy is not used. For example in the route:
> {code:xml}
> 	    <route id="DoubleSplitRoute">
> 	    	<from uri="direct:in" />
> 	    	<setBody>
> 	    		<constant>
> &lt;a&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;World&lt;/c&gt;
> 	&lt;/b&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;again&lt;/c&gt;
> 	&lt;/b&gt;
> &lt;/a&gt;
> 	    		</constant>
> 	    	</setBody>
> 			<split>
> 				<xpath>a/b</xpath>
> 				<split strategyRef="concatWithSpaceStrategy">
> 					<xpath>b/c/text()</xpath>
> 					<setBody><simple>${bodyAs(java.lang.String)}</simple></setBody>
> 					<log message="Got a part: ${body}"/>
> 				</split>
> 				<log message="Got a result: ${body}"/>
> 			</split>
> 		</route>
> {code}
> (where the {{concatWithSpaceStrategy}} does nothing more than to concat the bodies with a space inbetween.)
> The expected results would be:
> {code}
> Got a result: Hello World
> {code}
> and 
> {code}
> Got a result: Hello again
> {code}
> But that is not what happens. The actual results are two times the same:
> {code}
> Got a result: 
> <a>
> 	<b>
> 		<c>Hello</c>
> 		<c>World</c>
> 	</b>
> 	<b>
> 		<c>Hello</c>
> 		<c>again</c>
> 	</b>
> </a>
> {code}
> The reason is, that the strategy is not used. In the class {{org.apache.camel.processor.MulticastProcessor}}, in the method {{protected AggregationStrategy getAggregationStrategy(Exchange exchange)}}, the first step is to find an aggregationStrategy in the Exchange. This is set to {{UseOriginalAggregationStrategy}}, and because it is not null, this aggregation strategy will be used, not the one declared for the splitter.
> ---
> A workaround would be to remove the AggregationStrategy of the Exchange, before it is aggregated, by using a processor with the following process method:
> {code:java}
> 	public void process(Exchange exchange) throws Exception {
> 		if (exchange != null) {
> 			exchange.removeProperty(Exchange.AGGREGATION_STRATEGY);
> 		}
> 	}
> {code}
> After integrating this in my route, I got the desired results.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CAMEL-3677) When splitting inside another split, the custom aggregationStrategy is not used.

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995780#comment-12995780 ] 

Claus Ibsen commented on CAMEL-3677:
------------------------------------

Can you try with Camel 2.6.0 - We have fixed issus with splitter in that release.

> When splitting inside another split, the custom aggregationStrategy is not used.
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3677
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>         Environment: Mac OS X 10.6.6, Eclipse Helios
>            Reporter: Oliver Jelinski
>            Priority: Minor
>
> When splitting inside another split, the custom aggregationStrategy is not used. For example in the route:
> {code:xml}
> 	    <route id="DoubleSplitRoute">
> 	    	<from uri="direct:in" />
> 	    	<setBody>
> 	    		<constant>
> &lt;a&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;World&lt;/c&gt;
> 	&lt;/b&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;again&lt;/c&gt;
> 	&lt;/b&gt;
> &lt;/a&gt;
> 	    		</constant>
> 	    	</setBody>
> 			<split>
> 				<xpath>a/b</xpath>
> 				<split strategyRef="concatWithSpaceStrategy">
> 					<xpath>b/c/text()</xpath>
> 					<setBody><simple>${bodyAs(java.lang.String)}</simple></setBody>
> 					<log message="Got a part: ${body}"/>
> 				</split>
> 				<log message="Got a result: ${body}"/>
> 			</split>
> 		</route>
> {code}
> (where the {{concatWithSpaceStrategy}} does nothing more than to concat the bodies with a space inbetween.)
> The expected results would be:
> {code}
> Got a result: Hello World
> {code}
> and 
> {code}
> Got a result: Hello again
> {code}
> But that is not what happens. The actual results are two times the same:
> {code}
> Got a result: 
> <a>
> 	<b>
> 		<c>Hello</c>
> 		<c>World</c>
> 	</b>
> 	<b>
> 		<c>Hello</c>
> 		<c>again</c>
> 	</b>
> </a>
> {code}
> The reason is, that the strategy is not used. In the class {{org.apache.camel.processor.MulticastProcessor}}, in the method {{protected AggregationStrategy getAggregationStrategy(Exchange exchange)}}, the first step is to find an aggregationStrategy in the Exchange. This is set to {{UseOriginalAggregationStrategy}}, and because it is not null, this aggregation strategy will be used, not the one declared for the splitter.
> ---
> A workaround would be to remove the AggregationStrategy of the Exchange, before it is aggregated, by using a processor with the following process method:
> {code:java}
> 	public void process(Exchange exchange) throws Exception {
> 		if (exchange != null) {
> 			exchange.removeProperty(Exchange.AGGREGATION_STRATEGY);
> 		}
> 	}
> {code}
> After integrating this in my route, I got the desired results.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (CAMEL-3677) When splitting inside another split, the custom aggregationStrategy is not used.

Posted by "Oliver Jelinski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Jelinski closed CAMEL-3677.
----------------------------------

    Resolution: Fixed

Workaround no longer needed.

> When splitting inside another split, the custom aggregationStrategy is not used.
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3677
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3677
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>         Environment: Mac OS X 10.6.6, Eclipse Helios
>            Reporter: Oliver Jelinski
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> When splitting inside another split, the custom aggregationStrategy is not used. For example in the route:
> {code:xml}
> 	    <route id="DoubleSplitRoute">
> 	    	<from uri="direct:in" />
> 	    	<setBody>
> 	    		<constant>
> &lt;a&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;World&lt;/c&gt;
> 	&lt;/b&gt;
> 	&lt;b&gt;
> 		&lt;c&gt;Hello&lt;/c&gt;
> 		&lt;c&gt;again&lt;/c&gt;
> 	&lt;/b&gt;
> &lt;/a&gt;
> 	    		</constant>
> 	    	</setBody>
> 			<split>
> 				<xpath>a/b</xpath>
> 				<split strategyRef="concatWithSpaceStrategy">
> 					<xpath>b/c/text()</xpath>
> 					<setBody><simple>${bodyAs(java.lang.String)}</simple></setBody>
> 					<log message="Got a part: ${body}"/>
> 				</split>
> 				<log message="Got a result: ${body}"/>
> 			</split>
> 		</route>
> {code}
> (where the {{concatWithSpaceStrategy}} does nothing more than to concat the bodies with a space inbetween.)
> The expected results would be:
> {code}
> Got a result: Hello World
> {code}
> and 
> {code}
> Got a result: Hello again
> {code}
> But that is not what happens. The actual results are two times the same:
> {code}
> Got a result: 
> <a>
> 	<b>
> 		<c>Hello</c>
> 		<c>World</c>
> 	</b>
> 	<b>
> 		<c>Hello</c>
> 		<c>again</c>
> 	</b>
> </a>
> {code}
> The reason is, that the strategy is not used. In the class {{org.apache.camel.processor.MulticastProcessor}}, in the method {{protected AggregationStrategy getAggregationStrategy(Exchange exchange)}}, the first step is to find an aggregationStrategy in the Exchange. This is set to {{UseOriginalAggregationStrategy}}, and because it is not null, this aggregation strategy will be used, not the one declared for the splitter.
> ---
> A workaround would be to remove the AggregationStrategy of the Exchange, before it is aggregated, by using a processor with the following process method:
> {code:java}
> 	public void process(Exchange exchange) throws Exception {
> 		if (exchange != null) {
> 			exchange.removeProperty(Exchange.AGGREGATION_STRATEGY);
> 		}
> 	}
> {code}
> After integrating this in my route, I got the desired results.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira