Hi,

The following error is generated :

Caused by: java.lang.NullPointerException
    at
com.xpectis.x3s.core.util.x3sAggregationStrategy.aggregate(x3sAggregationStrategy.java:18)
    at
org.apache.camel.processor.MulticastProcessor.doAggregate(MulticastProcessor.java:208)
    at
org.apache.camel.processor.MulticastProcessor.doProcessSequntiel(MulticastProcessor.java:190)
    at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:121)
    at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)

with my route :

    <bean id="aggregationStrat"
class="com.xpectis.x3s.core.util.x3sAggregationStrategy" />

            <!-- Split the collection of messages -->
            <camel:split strategyRef="aggregationStrat">

                <camel:ognl>request.body</camel:ognl>

                <!-- (1) Call the service to save the request message -->
                <camel:bean ref="serviceHelper"
method="createRequestMessage"/>

                <!-- (2) Validate the business message -->
                <camel:bean ref="serviceHelper"
method="validateRequestMessage"/>

                <!-- (3) Save business message -->
                <camel:bean ref="serviceHelper"
method="saveRequestMessage"/>

            </camel:split>

public class x3sAggregationStrategy implements AggregationStrategy {

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {

        List requestMessages = new ArrayList();

        // Get old messages
        requestMessages = oldExchange.getOut().getBody(List.class); // =
LINE 18

        // Get new and add it to the list
        RequestMessage newReqMessage =
newExchange.getOut().getBody(RequestMessage.class);
        requestMessages.add(newReqMessage);

        // Add to the exchange
        oldExchange.getOut().setBody(requestMessages);

        return newExchange;

    }

}

I try to collect all the RequestMessage and put it in a collection that I
will use after the split. How can I do that ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Reply via email to