INT-1116: add message-store to XML
This commit is contained in:
@@ -58,7 +58,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
|
||||
public static final long DEFAULT_TIMEOUT = 60000L;
|
||||
|
||||
private final MessageGroupStore store;
|
||||
private MessageGroupStore messageStore;
|
||||
|
||||
private final MessageGroupProcessor outputProcessor;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) {
|
||||
Assert.notNull(store);
|
||||
Assert.notNull(processor);
|
||||
this.store = store;
|
||||
this.messageStore = store;
|
||||
store.registerExpiryCallback(new MessageGroupCallback() {
|
||||
public void execute(MessageGroup group) {
|
||||
forceComplete(group);
|
||||
@@ -100,6 +100,10 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
public CorrelatingMessageHandler(MessageGroupProcessor processor) {
|
||||
this(processor, new SimpleMessageStore(0), null, null);
|
||||
}
|
||||
|
||||
public void setMessageStore(MessageGroupStore messageStore) {
|
||||
this.messageStore = messageStore;
|
||||
}
|
||||
|
||||
public void setCorrelationStrategy(CorrelationStrategy correlationStrategy) {
|
||||
Assert.notNull(correlationStrategy);
|
||||
@@ -149,7 +153,7 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
Object lock = getLock(correlationKey);
|
||||
synchronized (lock) {
|
||||
|
||||
MessageGroup group = store.getMessageGroup(correlationKey);
|
||||
MessageGroup group = messageStore.getMessageGroup(correlationKey);
|
||||
|
||||
if (group.add(message)) {
|
||||
|
||||
@@ -238,17 +242,17 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
}
|
||||
|
||||
private void mark(MessageGroup group) {
|
||||
store.markMessageGroup(group);
|
||||
messageStore.markMessageGroup(group);
|
||||
}
|
||||
|
||||
private void remove(MessageGroup group) {
|
||||
Object correlationKey = group.getCorrelationKey();
|
||||
store.removeMessageGroup(correlationKey);
|
||||
messageStore.removeMessageGroup(correlationKey);
|
||||
locks.remove(correlationKey);
|
||||
}
|
||||
|
||||
private void store(Object correlationKey, Message<?> message) {
|
||||
store.addMessageToGroup(correlationKey, message);
|
||||
messageStore.addMessageToGroup(correlationKey, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class AggregatorParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
private static final String CORRELATION_STRATEGY_METHOD_ATTRIBUTE = "correlation-strategy-method";
|
||||
|
||||
private static final String MESSAGE_STORE_ATTRIBUTE = "message-store";
|
||||
|
||||
private static final String OUTPUT_CHANNEL_ATTRIBUTE = "output-channel";
|
||||
|
||||
private static final String DISCARD_CHANNEL_ATTRIBUTE = "discard-channel";
|
||||
@@ -86,6 +88,8 @@ public class AggregatorParser extends AbstractConsumerEndpointParser {
|
||||
processorBuilder.getRawBeanDefinition().getConstructorArgumentValues().addGenericArgumentValue(method, "java.lang.String");
|
||||
}
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
MESSAGE_STORE_ATTRIBUTE);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
DISCARD_CHANNEL_ATTRIBUTE);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.w3c.dom.Element;
|
||||
* Parser for the <resequencer> element.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class ResequencerParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
@@ -60,6 +61,7 @@ public class ResequencerParser extends AbstractConsumerEndpointParser {
|
||||
// Release strategy
|
||||
builder.addConstructorArgReference(processorRef);
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-store");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "discard-channel");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-timeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-partial-result-on-timeout");
|
||||
|
||||
@@ -1749,6 +1749,21 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="message-store" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Reference to a MessageGroupStore for holding state in between message processing. The default
|
||||
is to use a volatile in-memory store, which means that unprocessed messages will be lost if the
|
||||
JVM exits. To customize the expiry of incomplete message groups configure the message store.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.integration.store.MessageGroupStore" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="send-partial-result-on-timeout" type="xsd:string" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
@@ -1792,6 +1807,21 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="message-store" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Reference to a MessageGroupStore for holding state in between message processing. The default
|
||||
is to use a volatile in-memory store, which means that unprocessed messages will be lost if the
|
||||
JVM exits. To customize the expiry of incomplete message groups configure the message store.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.integration.store.MessageGroupStore" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="comparator" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
|
||||
Reference in New Issue
Block a user