populating component metadata with type

This commit is contained in:
Mark Fisher
2010-03-11 20:07:00 +00:00
parent d0ab4dafb2
commit 1afd8751eb
3 changed files with 19 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ import java.util.List;
import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.support.ComponentMetadata;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
@@ -47,9 +48,6 @@ import org.springframework.util.CollectionUtils;
public abstract class AbstractMessageAggregator extends
AbstractMessageBarrierHandler<List<Message<?>>> {
public static final String COMPONENT_TYPE_LABEL = "aggregator";
private volatile CompletionStrategy completionStrategy = new SequenceSizeCompletionStrategy();
@@ -62,6 +60,11 @@ public abstract class AbstractMessageAggregator extends
this.completionStrategy = completionStrategy;
}
@Override
protected void populateComponentMetadata(ComponentMetadata metadata) {
metadata.setComponentType("aggregator");
}
@Override
protected MessageBarrier<List<Message<?>>> createMessageBarrier(Object correlationKey) {
return new MessageBarrier<List<Message<?>>>(new ArrayList<Message<?>>(), correlationKey);

View File

@@ -19,7 +19,6 @@ package org.springframework.integration.aggregator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.Lifecycle;
import org.springframework.integration.channel.ChannelResolver;
import org.springframework.integration.channel.MessageChannelTemplate;
@@ -32,6 +31,7 @@ import org.springframework.integration.handler.AbstractMessageHandler;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.store.MessageStore;
import org.springframework.integration.store.SimpleMessageStore;
import org.springframework.integration.support.ComponentMetadata;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert;
@@ -55,13 +55,10 @@ import java.util.concurrent.locks.ReentrantLock;
* @author Iwein Fuld
* @since 2.0
*/
public class CorrelatingMessageHandler extends AbstractMessageHandler
implements MessageProducer, Lifecycle, BeanFactoryAware {
public class CorrelatingMessageHandler extends AbstractMessageHandler implements MessageProducer, Lifecycle {
private static final Log logger = LogFactory.getLog(CorrelatingMessageHandler.class);
public static final String COMPONENT_TYPE_LABEL = "aggregator";
private static final long DEFAULT_SEND_TIMEOUT = 1000l;
private static final long DEFAULT_REAPER_INTERVAL = 1000l;
private static final long DEFAULT_TIMEOUT = 60000l;
@@ -160,8 +157,12 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler
this.sendPartialResultOnTimeout = sendPartialResultOnTimeout;
}
@Override
protected void populateComponentMetadata(ComponentMetadata metadata) {
metadata.setComponentType("aggregator");
}
@Override
protected void handleMessageInternal(Message<?> message) throws Exception {
Object correlationKey = correlationStrategy.getCorrelationKey(message);
if (logger.isDebugEnabled()) {

View File

@@ -23,6 +23,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.springframework.integration.core.Message;
import org.springframework.integration.support.ComponentMetadata;
import org.springframework.util.CollectionUtils;
/**
@@ -53,9 +54,6 @@ import org.springframework.util.CollectionUtils;
*/
public class Resequencer extends AbstractMessageBarrierHandler<SortedSet<Message<?>>> {
public static final String COMPONENT_TYPE_LABEL = "resequencer";
private volatile boolean releasePartialSequences = true;
private static final String LAST_RELEASED_SEQUENCE_NUMBER = "last.released.sequence.number";
@@ -65,6 +63,11 @@ public class Resequencer extends AbstractMessageBarrierHandler<SortedSet<Message
this.releasePartialSequences = releasePartialSequences;
}
@Override
protected void populateComponentMetadata(ComponentMetadata metadata) {
metadata.setComponentType("resequencer");
}
@Override
protected MessageBarrier<SortedSet<Message<?>>> createMessageBarrier(Object correlationKey) {
MessageBarrier<SortedSet<Message<?>>> messageBarrier