using aggregator - camel 2.6.0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view

using aggregator - camel 2.6.0

    i am trying to use the aggregator pattern in a route
    and i get this error:
    "Cannot find class [org.apache.camel.processor.aggregate.AggregationStrategy]"
    i also added camel-core dependency in pom.xml :


    this is an example implementation of the aggregator strategy that i use

    package de.edigrid.util.servicemix;

import org.apache.log4j.Logger;
import org.apache.camel.Exchange;
import org.apache.camel.processor.aggregate.AggregationStrategy;
import org.springframework.stereotype.Component;

public class MyAggregationStrategy implements AggregationStrategy {

    Logger logger = Logger.getLogger(MyAggregationStrategy.class.getName());

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        if (oldExchange == null) {
            return newExchange;
        String body1 = oldExchange.getIn().getBody(String.class);
        String body2 = newExchange.getIn().getBody(String.class);

        oldExchange.getIn().setBody(body1 + body2);"Aggregation current state for "+ oldExchange.getIn().getHeader("CamelFileName") +": "+ oldExchange.getIn());
        return oldExchange;

    the service-bundle config:

<bean id="aggregatorStrategy" class="de.edigrid.util.servicemix.MyAggregationStrategy" autowire="byName"/>
        <osgi:service id="aggregatorStrategyService" ref="aggregatorStrategy" interface="org.apache.camel.processor.aggregate.AggregationStrategy" />

    this is the route:

<beans ...>
  <osgi:reference id="aggregatorStrategyService" interface="org.apache.camel.processor.aggregate.AggregationStrategy" bean-name="aggregatorStrategy"/>
  <camelContext xmlns="" id="camelContext">   
    <route id="TEST">
      <from uri="file://"/>
      <aggregate strategyRef="aggregatorStrategy">
        <to uri="direct://SPLITTER"/>
    <route id="TEST2">
      <from uri="direct://SPLITTER"/>
      <to uri="file://"/>

Can anyone please help ?

Thank you,
Reply | Threaded
Open this post in threaded view

Re: using aggregator - camel 2.6.0

>    "Cannot find class
> [org.apache.camel.processor.aggregate.AggregationStrategy]"
> ...
>  <osgi:reference id="aggregatorStrategyService"
> interface="org.apache.camel.processor.aggregate.AggregationStrategy"
> bean-name="aggregatorStrategy"/>

The most probably source of your problems is that you're got a wrong
configuration of BND Maven plugin [1]. This is common problem related
to the Blueprint support. I'm guessing that you're using it since you
wrote that you're using Maven for the project.

I could help you if send me minimal Maven project containing your
invalid configuration (so I can reproduce the bug).

Kind regards.


Henryk Konsek
Reply | Threaded
Open this post in threaded view

Re: using aggregator - camel 2.6.0

Hello Henryk,
thank you for you're time

attached is my pom configuration, maybe you figure out from this

Best Regards,