0
votes

I am building a system that call many and diffrent web service and i wish to generate a report about all errors returned after calling ws.

For that, I use an <int:aggregator: > to aggregate messages from error-channel but i can't know the release-strategy because , i like to aggregate all messages of error-channel. so how can i configure <int:aggregator > to aggregate all messages.

<int:aggregator 
    correlation-strategy-expression="'${error.msg.correlation.key}'" 
    input-channel="ws.rsp.error.channel"
    output-channel="outboundMailChannel"
     ref="errorAggregator"
     method="generateErrorReport"
    release-strategy-expression="false" 
    group-timeout="2000"

expire-groups-upon-completion="true"/>

<int:service-activator
    input-channel="outboundMailChannel"
     ref="errorMsgAgregatedActivator"
         method="handleMessage"
/>

And the activator:

@ServiceActivator
public void handleMessage(Message<Collection<Object>> errorList) {

    Collection<Object> payload=errorList.getPayload();
   System.out.println("error list: "+payload.toString());
}

thanks.

1

1 Answers

1
votes

Aggregation either needs an appropriate release strategy, or you can simply use release-strategy-expression="false" (never release), and use a group-timeout to release whatever's in the group after some time.

You may want to use a constant correlation correlation-strategy-expresision="'foo'" and set expire-groups-upon-completion="true" so a new group starts with the next message.