INT-1093:
- Added testcases from the issue - added convenience method for total completion to MessageGroup - resolved issue by invoking callback
This commit is contained in:
@@ -16,15 +16,8 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.channel.MessageChannelTemplate;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
@@ -32,6 +25,8 @@ import org.springframework.integration.core.MessageHeaders;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Base class for MessageGroupProcessor implementations that aggregate the
|
||||
* group of Messages into a single Message.
|
||||
@@ -53,6 +48,7 @@ public abstract class AbstractAggregatingMessageGroupProcessor implements Messag
|
||||
Map<String, Object> headers = this.aggregateHeaders(group);
|
||||
Message<?> message = MessageBuilder.withPayload(payload).copyHeadersIfAbsent(headers).build();
|
||||
channelTemplate.send(message, outputChannel);
|
||||
group.onCompleteProcessing();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,14 +16,10 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Represents a mutable group of correlated messages that is bound to a certain
|
||||
* {@link org.springframework.integration.store.MessageStore} and correlation
|
||||
@@ -128,4 +124,13 @@ public class MessageGroup {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a shorthand for signaling that all messages in the group have been
|
||||
* processed and that the group is completed.
|
||||
*/
|
||||
public void onCompleteProcessing() {
|
||||
onProcessingOf(messages.toArray(new Message[messages.size()]));
|
||||
onCompletion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user