Hi,
You can use aggregator pattern. Take a look on the sample cafe application. There is a example how to overwrite correlation strategy.
Code:
@MessageEndpoint
public class Waiter {
@Aggregator(inputChannel = "preparedDrinks", outputChannel = "deliveries")
public Delivery prepareDelivery(List<Drink> drinks) {
return new Delivery(drinks);
}
@CorrelationStrategy
public int correlateByOrderNumber(Drink drink) {
return drink.getOrderNumber();
}
}
I forgot to mention that you have to be aware of the 'ReleaseStrategy' for aggregator. Check the documentation for more details - http://bit.ly/k7U7bc
I hope it helps,
Krzysiek