servicemix 3.3.2 camel-core 2.2.0 custom aggregation having problems
----------------------------------------------------------------------
Key: SM-1975
URL: https://issues.apache.org/activemq/browse/SM-1975
Project: ServiceMix
Issue Type: Bug
Components: servicemix-camel
Affects Versions: 3.3.2
Environment: Windows XP
Reporter: Alex C Punnen
Priority: Blocker
Fix For: 3.3.3
We recently updated from servicemix 3.3.1 to version 3.3.2. We are using
servicemix-camel component and making use of a custom aggregation for our
functionality. This was working fine with camel 3.3.1.
We found out that servicemix 3.3.2 now supports camel 2.2 . So we changed the
namespace and also I had to change certain method signature. But now nothing
happens on aggregation. Digging further we realized that the body that is
passed into the aggregator object is null. Since we were using xpath to group
messages based on the value of a field in the body of the NMR, the fact that
the body is coming as null could be the reason that nothing is happening on
aggregation.
Here is the code snippet which was working in 1.6
-----------
public class MyAggregationStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
String oldBody = oldExchange.getIn().getBody(String.class);
String newBody = newIn.getBody(String.class);
System.out.println("---------------------------");
System.out.println("New Body "+newBody);
System.out.println("Old Body "+oldBody);
System.out.println("---------------------------");
-------------------------------------------------------------------------------------
New Body null
Old Body null
---------------------------
---------------------------
New Body Out null
Old Body Out null
---------------------------
-------------------------------------
Here is the route
--------------------------------
public class MyRouteBuilder extends RouteBuilder {
public void configure() {
System.out.println("In MyRouteBuilder------------------");
Namespaces ns = new Namespaces("p",
"http://nsn.com/obs/mw/medfra/snmpbc")
.add("xsd", "http://www.w3.org/2001/XMLSchema");
from("jbi:service:http://servicemix.apache.org/test/camel-receiver")
.aggregate(new MyAggregationStrategy()) //camel 2
//.aggregator(new MyAggregationStrategy()) //camel 1.6
.xpath("string(/p:snmp-getResponse/p:NE/@ipaddr)",String.class, ns)
//.completedPredicate(header("completed").isEqualTo("true")) //camel 1.6
.completionPredicate(header("completed").isEqualTo("true")) //camel 2
//.to("jbi:endpoint:http://servicemix.apache.org/test/file_sender_getbulk/endpoint");
.to("log:tutorial"); //for test
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.