Class BarrierMessageHandler

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, DiscardingMessageHandler, HeaderPropagationAware, MessageTriggerAction, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class BarrierMessageHandler extends AbstractReplyProducingMessageHandler implements MessageTriggerAction, DiscardingMessageHandler
A message handler that suspends the thread until a message with corresponding correlation is passed into the trigger method or the timeout occurs. Only one thread with a particular correlation (result of invoking the CorrelationStrategy) can be suspended at a time. If the inbound thread does not arrive before the trigger thread, the latter is suspended until it does, or the timeout occurs. Separate timeouts may be configured for request and trigger messages.

The default CorrelationStrategy is a HeaderAttributeCorrelationStrategy.

The default output processor is a DefaultAggregatingMessageGroupProcessor.

Since:
4.2
Author:
Gary Russell, Artem Bilan, Michel Jung
  • Constructor Details

    • BarrierMessageHandler

      public BarrierMessageHandler(long timeout)
      Construct an instance with the provided timeout and default correlation and output strategies.
      Parameters:
      timeout - the timeout in milliseconds for both, request and trigger messages.
    • BarrierMessageHandler

      public BarrierMessageHandler(long timeout, MessageGroupProcessor outputProcessor)
      Construct an instance with the provided timeout and output processor, and default correlation strategy.
      Parameters:
      timeout - the timeout in milliseconds for both, request and trigger messages.
      outputProcessor - the output MessageGroupProcessor.
    • BarrierMessageHandler

      public BarrierMessageHandler(long timeout, CorrelationStrategy correlationStrategy)
      Construct an instance with the provided timeout and correlation strategy, and default output processor.
      Parameters:
      timeout - the timeout in milliseconds for both, request and trigger messages.
      correlationStrategy - the correlation strategy.
    • BarrierMessageHandler

      public BarrierMessageHandler(long timeout, MessageGroupProcessor outputProcessor, CorrelationStrategy correlationStrategy)
      Construct an instance with the provided timeout and output processor, and default correlation strategy.
      Parameters:
      timeout - the timeout in milliseconds for both, request and trigger messages.
      outputProcessor - the output MessageGroupProcessor.
      correlationStrategy - the correlation strategy.
    • BarrierMessageHandler

      public BarrierMessageHandler(long requestTimeout, long triggerTimeout)
      Construct an instance with the provided timeouts and default correlation and output strategies.
      Parameters:
      requestTimeout - the timeout in milliseconds when waiting for trigger message.
      triggerTimeout - the timeout in milliseconds when waiting for a request message.
      Since:
      5.4
    • BarrierMessageHandler

      public BarrierMessageHandler(long requestTimeout, long triggerTimeout, MessageGroupProcessor outputProcessor)
      Construct an instance with the provided timeout and output processor, and default correlation strategy.
      Parameters:
      requestTimeout - the timeout in milliseconds when waiting for trigger message.
      triggerTimeout - the timeout in milliseconds when waiting for a request message.
      outputProcessor - the output MessageGroupProcessor.
      Since:
      5.4
    • BarrierMessageHandler

      public BarrierMessageHandler(long requestTimeout, long triggerTimeout, CorrelationStrategy correlationStrategy)
      Construct an instance with the provided timeout and correlation strategy, and default output processor.
      Parameters:
      requestTimeout - the timeout in milliseconds when waiting for trigger message.
      triggerTimeout - the timeout in milliseconds when waiting for a request message.
      correlationStrategy - the correlation strategy.
      Since:
      5.4
    • BarrierMessageHandler

      public BarrierMessageHandler(long requestTimeout, long triggerTimeout, MessageGroupProcessor outputProcessor, CorrelationStrategy correlationStrategy)
      Construct an instance with the provided timeout and output processor, and default correlation strategy.
      Parameters:
      requestTimeout - the timeout in milliseconds when waiting for trigger message.
      triggerTimeout - the timeout in milliseconds when waiting for a request message.
      outputProcessor - the output MessageGroupProcessor.
      correlationStrategy - the correlation strategy.
      Since:
      5.4
  • Method Details