ServiceMix
  1. ServiceMix
  2. SM-1975

servicemix 3.3.2 camel-core 2.2.0 custom aggregation having problems

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.4.2
    • Component/s: servicemix-camel
    • Labels:
      None
    • Environment:

      Windows XP

    • Regression:
      Regression

      Description

      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

        Activity

        Hide
        Jean-Baptiste Onofré added a comment -

        ServiceMix 3.3.3 now includes Camel 2.6.

        I'm gonna test your use case on 3.3.3-SNAPSHOT to see if it already occurs.

        Show
        Jean-Baptiste Onofré added a comment - ServiceMix 3.3.3 now includes Camel 2.6. I'm gonna test your use case on 3.3.3-SNAPSHOT to see if it already occurs.

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Alex C Punnen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development