Renamed AggregatingMessageHandler to AggregatorEndpoint and AggregatorAdapter to MethodInvokingAggregator.

This commit is contained in:
Mark Fisher
2008-09-04 21:00:26 +00:00
parent 3a5bfca9f9
commit 84073697e9
12 changed files with 104 additions and 104 deletions

View File

@@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.endpoint.AbstractInOutEndpoint;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.message.BlockingTarget;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageHandlingException;
@@ -43,12 +43,12 @@ import org.springframework.util.ObjectUtils;
/**
* Base class for {@link MessageBarrier}-based MessageHandlers.
* A {@link MessageHandler} implementation that waits for a group of
* A {@link MessageEndpoint} implementation that waits for a group of
* {@link Message Messages} to arrive and processes them together.
* Uses a {@link MessageBarrier} to store messages and to decide how
* the messages should be released.
* <p>
* Each {@link Message} that is received by this handler will be associated with
* Each {@link Message} that is received by this endpoint will be associated with
* a group based upon the '<code>correlationId</code>' property of its
* header. If no such property is available, a {@link MessageHandlingException}
* will be thrown.
@@ -62,7 +62,7 @@ import org.springframework.util.ObjectUtils;
* @author Mark Fisher
* @author Marius Bogoevici
*/
public abstract class AbstractMessageBarrierHandler extends AbstractInOutEndpoint implements InitializingBean {
public abstract class AbstractMessageBarrierEndpoint extends AbstractInOutEndpoint implements InitializingBean {
public final static long DEFAULT_SEND_TIMEOUT = 1000;
@@ -96,7 +96,7 @@ public abstract class AbstractMessageBarrierHandler extends AbstractInOutEndpoin
private volatile boolean initialized;
public AbstractMessageBarrierHandler(ScheduledExecutorService executor) {
public AbstractMessageBarrierEndpoint(ScheduledExecutorService executor) {
this.executor = (executor != null) ? executor : Executors.newSingleThreadScheduledExecutor();
}

View File

@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/**
* An {@link AbstractMessageBarrierHandler} that waits for a <em>complete</em>
* An {@link AbstractMessageBarrierEndpoint} that waits for a <em>complete</em>
* group of {@link Message Messages} to arrive and then delegates to an
* {@link Aggregator} to combine them into a single {@link Message}.
* <p>
@@ -34,13 +34,13 @@ import org.springframework.util.CollectionUtils;
* custom implementation of the {@link CompletionStrategy} may be provided.
* <p>
* All considerations regarding <code>timeout</code> and grouping by
* '<code>correlationId</code>' from {@link AbstractMessageBarrierHandler} apply
* '<code>correlationId</code>' from {@link AbstractMessageBarrierEndpoint} apply
* here as well.
*
* @author Mark Fisher
* @author Marius Bogoevici
*/
public class AggregatingMessageHandler extends AbstractMessageBarrierHandler {
public class AggregatorEndpoint extends AbstractMessageBarrierEndpoint {
private final Aggregator aggregator;
@@ -48,18 +48,18 @@ public class AggregatingMessageHandler extends AbstractMessageBarrierHandler {
/**
* Create a handler that delegates to the provided aggregator to combine a
* Create an endpoint that delegates to the provided Aggregator to combine a
* group of messages into a single message. The executor will be used for
* scheduling a background maintenance thread. If <code>null</code>, a new
* single-threaded executor will be created.
*/
public AggregatingMessageHandler(Aggregator aggregator, ScheduledExecutorService executor) {
public AggregatorEndpoint(Aggregator aggregator, ScheduledExecutorService executor) {
super(executor);
Assert.notNull(aggregator, "'aggregator' must not be null");
this.aggregator = aggregator;
}
public AggregatingMessageHandler(Aggregator aggregator) {
public AggregatorEndpoint(Aggregator aggregator) {
this(aggregator, null);
}

View File

@@ -31,13 +31,13 @@ import org.springframework.integration.message.Message;
* @author Marius Bogoevici
* @author Mark Fisher
*/
public class AggregatorAdapter extends MessageListMethodAdapter implements Aggregator {
public class MethodInvokingAggregator extends MessageListMethodAdapter implements Aggregator {
public AggregatorAdapter(Object object, Method method) {
public MethodInvokingAggregator(Object object, Method method) {
super(object, method);
}
public AggregatorAdapter(Object object, String methodName) {
public MethodInvokingAggregator(Object object, String methodName) {
super(object, methodName);
}

View File

@@ -23,7 +23,7 @@ import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageHeaders;
/**
* An {@link AbstractMessageBarrierHandler} that waits for a group of
* An {@link AbstractMessageBarrierEndpoint} that waits for a group of
* {@link Message Messages} to arrive and re-sends them in order, sorted
* by their <code>sequenceNumber</code>.
* <p>
@@ -31,12 +31,12 @@ import org.springframework.integration.message.MessageHeaders;
* wait for the whole sequence to arrive before re-sending them.
* <p>
* All considerations regarding <code>timeout</code> and grouping by
* '<code>correlationId</code>' from {@link AbstractMessageBarrierHandler} apply
* '<code>correlationId</code>' from {@link AbstractMessageBarrierEndpoint} apply
* here as well.
*
* @author Marius Bogoevici
*/
public class ResequencingMessageHandler extends AbstractMessageBarrierHandler {
public class ResequencingMessageHandler extends AbstractMessageBarrierEndpoint {
private volatile boolean releasePartialSequences = true;

View File

@@ -22,7 +22,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.integration.aggregator.AggregatingMessageHandler;
import org.springframework.integration.aggregator.AggregatorEndpoint;
/**
* Indicates that a method is capable of aggregating messages.
@@ -56,12 +56,12 @@ public @interface Aggregator {
/**
* timeout for sending results to the reply target (in milliseconds)
*/
long sendTimeout() default AggregatingMessageHandler.DEFAULT_SEND_TIMEOUT;
long sendTimeout() default AggregatorEndpoint.DEFAULT_SEND_TIMEOUT;
/**
* maximum time to wait for completion (in milliseconds)
*/
long timeout() default AggregatingMessageHandler.DEFAULT_TIMEOUT;
long timeout() default AggregatorEndpoint.DEFAULT_TIMEOUT;
/**
* indicates whether to send an incomplete aggregate on timeout
@@ -71,13 +71,13 @@ public @interface Aggregator {
/**
* interval for the task that checks for timed-out aggregates
*/
long reaperInterval() default AggregatingMessageHandler.DEFAULT_REAPER_INTERVAL;
long reaperInterval() default AggregatorEndpoint.DEFAULT_REAPER_INTERVAL;
/**
* maximum number of correlation IDs to maintain so that received messages
* may be recognized as belonging to an aggregate that has already completed
* or timed out
*/
int trackedCorrelationIdCapacity() default AggregatingMessageHandler.DEFAULT_TRACKED_CORRRELATION_ID_CAPACITY;
int trackedCorrelationIdCapacity() default AggregatorEndpoint.DEFAULT_TRACKED_CORRRELATION_ID_CAPACITY;
}

View File

@@ -21,8 +21,8 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.aggregator.AggregatingMessageHandler;
import org.springframework.integration.aggregator.AggregatorAdapter;
import org.springframework.integration.aggregator.AggregatorEndpoint;
import org.springframework.integration.aggregator.MethodInvokingAggregator;
import org.springframework.integration.aggregator.CompletionStrategyAdapter;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.util.StringUtils;
@@ -59,12 +59,12 @@ public class AggregatorParser extends AbstractEndpointParser {
@Override
protected Class<? extends MessageEndpoint> getEndpointClass() {
return AggregatingMessageHandler.class;
return AggregatorEndpoint.class;
}
@Override
protected Class<?> getMethodInvokingAdapterClass() {
return AggregatorAdapter.class;
return MethodInvokingAggregator.class;
}
@Override

View File

@@ -21,8 +21,8 @@ import java.lang.reflect.Method;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.aggregator.AggregatingMessageHandler;
import org.springframework.integration.aggregator.AggregatorAdapter;
import org.springframework.integration.aggregator.AggregatorEndpoint;
import org.springframework.integration.aggregator.MethodInvokingAggregator;
import org.springframework.integration.aggregator.CompletionStrategyAdapter;
import org.springframework.integration.annotation.Aggregator;
import org.springframework.integration.annotation.CompletionStrategy;
@@ -47,13 +47,13 @@ public class AggregatorAnnotationPostProcessor extends AbstractMethodAnnotationP
@Override
protected Object createMethodInvokingAdapter(Object bean, Method method, Aggregator annotation) {
return new AggregatorAdapter(bean, method);
return new MethodInvokingAggregator(bean, method);
}
@Override
protected AbstractEndpoint createEndpoint(Object originalBean, Object adapter) {
if (adapter instanceof org.springframework.integration.aggregator.Aggregator) {
AggregatingMessageHandler endpoint = new AggregatingMessageHandler((org.springframework.integration.aggregator.Aggregator) adapter);
AggregatorEndpoint endpoint = new AggregatorEndpoint((org.springframework.integration.aggregator.Aggregator) adapter);
this.configureCompletionStrategy(originalBean, endpoint);
return endpoint;
}
@@ -63,7 +63,7 @@ public class AggregatorAnnotationPostProcessor extends AbstractMethodAnnotationP
@Override
protected void configureEndpoint(AbstractEndpoint endpoint, Aggregator annotation, Poller pollerAnnotation) {
super.configureEndpoint(endpoint, annotation, pollerAnnotation);
AggregatingMessageHandler aggregatorEndpoint = (AggregatingMessageHandler) endpoint;
AggregatorEndpoint aggregatorEndpoint = (AggregatorEndpoint) endpoint;
String discardChannelName = annotation.discardChannel();
if (StringUtils.hasText(discardChannelName)) {
MessageChannel discardChannel = this.getChannelRegistry().lookupChannel(discardChannelName);
@@ -80,7 +80,7 @@ public class AggregatorAnnotationPostProcessor extends AbstractMethodAnnotationP
aggregatorEndpoint.afterPropertiesSet();
}
private void configureCompletionStrategy(final Object object, final AggregatingMessageHandler handler) {
private void configureCompletionStrategy(final Object object, final AggregatorEndpoint handler) {
ReflectionUtils.doWithMethods(object.getClass(), new ReflectionUtils.MethodCallback() {
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.getAnnotation(method, CompletionStrategy.class);