@Override public void setBeanFactory(BeanFactory beanFactory) { super.setBeanFactory(beanFactory); this.processor.setBeanFactory(beanFactory); }
@Override public void setBeanFactory(BeanFactory beanFactory) { super.setBeanFactory(beanFactory); this.processor.setBeanFactory(beanFactory); }
/** * Set {@code releasePartialSequences} on an underlying default * {@link SequenceSizeReleaseStrategy}. Ignored for other release strategies. * @param releasePartialSequences true to allow release. */ public void setReleasePartialSequences(boolean releasePartialSequences) { if (!this.releaseStrategySet && releasePartialSequences) { setReleaseStrategy(new SequenceSizeReleaseStrategy()); } this.releasePartialSequences = releasePartialSequences; }
@Bean @ServiceActivator(inputChannel = "aggregatorChannel") public MessageHandler aggregator() { AggregatingMessageHandler handler = new AggregatingMessageHandler(new SimpleMessageGroupProcessor()); handler.setCorrelationStrategy(new ExpressionEvaluatingCorrelationStrategy("1")); handler.setReleaseStrategy(new ExpressionEvaluatingReleaseStrategy("size() == 10")); handler.setOutputChannelName("splitterChannel"); return handler; }
@Bean public MessageHandler gatherer2() { return new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor(), new SimpleMessageStore(), new HeaderAttributeCorrelationStrategy(IntegrationMessageHeaderAccessor.CORRELATION_ID), new MessageCountReleaseStrategy(3)); }
@Bean public MessageHandler gatherer1() { return new AggregatingMessageHandler( new ExpressionEvaluatingMessageGroupProcessor("^[payload gt 5] ?: -1D"), new SimpleMessageStore(), new HeaderAttributeCorrelationStrategy(IntegrationMessageHeaderAccessor.CORRELATION_ID), new ExpressionEvaluatingReleaseStrategy("size() == 2")); }
AggregatorSpec() { super(new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor())); }
/** * Construct an instance with the provided timeout and default correlation and * output strategies. * @param timeout the timeout in milliseconds. */ public BarrierMessageHandler(long timeout) { this(timeout, new DefaultAggregatingMessageGroupProcessor()); }
ResequencerSpec() { super(new ResequencingMessageHandler(new ResequencingMessageGroupProcessor())); }
/** * {@inheritDoc} * * (overridden to false for a resequencer so late messages are immediately discarded rather * than waiting for the next timeout) */ @Override public final void setExpireGroupsUponTimeout(boolean expireGroupsUponTimeout) { super.setExpireGroupsUponTimeout(expireGroupsUponTimeout); }
/** * Creates a wrapper around the object passed in. This constructor will look for a method that can process * a list of messages. * * @param target the object to wrap */ public MethodInvokingMessageGroupProcessor(Object target) { this.processor = new MethodInvokingMessageListProcessor<Object>(target, Aggregator.class); }
public ResequencingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) { super(processor, store, correlationStrategy, releaseStrategy); this.setExpireGroupsUponTimeout(false); }
/** * Evaluate the expression provided on the {@link MessageGroup} * and return the result (must be boolean). */ public boolean canRelease(MessageGroup messages) { return evaluateExpression(this.expression, messages, Boolean.class); }
/** * Subclasses may override if special action is needed because the group was released or discarded * due to a timeout. By default, {@link #afterRelease(MessageGroup, Collection)} is invoked. * @param group The group. * @param completedMessages The completed messages. * @param timeout True if the release/discard was due to a timeout. */ protected void afterRelease(MessageGroup group, Collection<Message<?>> completedMessages, boolean timeout) { afterRelease(group, completedMessages); }
@Override public Object processMessageGroup(MessageGroup group) { forceComplete(group); return null; }
/** * Processes the Message by evaluating the expression with that Message as the root object. The expression * evaluation result Object will be returned. */ @Override public Object process(Collection<? extends Message<?>> messages) { return this.evaluateExpression(this.expression, messages, this.expectedType); }
/** * Construct an instance with the provided timeout and correlation strategy, and default * output processor. * @param timeout the timeout in milliseconds. * @param correlationStrategy the correlation strategy. */ public BarrierMessageHandler(long timeout, CorrelationStrategy correlationStrategy) { this(timeout, new DefaultAggregatingMessageGroupProcessor(), correlationStrategy); }
/** * Creates a wrapper around the object passed in. * * @param target the object to wrap * @param method the method to invoke */ public MethodInvokingMessageGroupProcessor(Object target, Method method) { this.processor = new MethodInvokingMessageListProcessor<Object>(target, method); }
public ResequencingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store) { super(processor, store); this.setExpireGroupsUponTimeout(false); }
/** * Creates a wrapper around the object passed in. This constructor will look for a named method specifically and * fail when it cannot find a method with the given name. * * @param target the object to wrap * @param methodName the name of the method to invoke */ public MethodInvokingMessageGroupProcessor(Object target, String methodName) { this.processor = new MethodInvokingMessageListProcessor<Object>(target, methodName); }