Class DirectRabbitListenerContainerFactory

All Implemented Interfaces:
RabbitListenerContainerFactory<DirectMessageListenerContainer>, Aware, ApplicationContextAware, ApplicationEventPublisherAware

public class DirectRabbitListenerContainerFactory extends AbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>
Gary Russell, Sud Ramasamy
  • Constructor Details

    • DirectRabbitListenerContainerFactory

      public DirectRabbitListenerContainerFactory()
  • Method Details

    • setTaskScheduler

      public void setTaskScheduler(TaskScheduler taskScheduler)
      Set the task scheduler to use for the task that monitors idle containers and failed consumers.
      taskScheduler - the scheduler.
    • setMonitorInterval

      public void setMonitorInterval(long monitorInterval)
      Set how often to run a task to check for failed consumers and idle containers.
      monitorInterval - the interval; default 10000 but it will be adjusted down to the smallest of this, idleEventInterval / 2 (if configured) or failedDeclarationRetryInterval.
    • setConsumersPerQueue

      public void setConsumersPerQueue(Integer consumersPerQueue)
      Each queue runs in its own consumer; set this property to create multiple consumers for each queue. If the container is already running, the number of consumers per queue will be adjusted up or down as necessary.
      consumersPerQueue - the consumers per queue.
    • setMessagesPerAck

      public void setMessagesPerAck(Integer messagesPerAck)
      Set the number of messages to receive before acknowledging (success). A failed message will short-circuit this counter.
      messagesPerAck - the number of messages.
      See Also:
    • setAckTimeout

      public void setAckTimeout(Long ackTimeout)
      An approximate timeout; when messagesPerAck is greater than 1, and this time elapses since the last ack, the pending acks will be sent either when the next message arrives, or a short time later if no additional messages arrive. In that case, the actual time depends on the monitorInterval.
      ackTimeout - the timeout in milliseconds (default 20000);
      See Also:
    • createContainerInstance

      protected DirectMessageListenerContainer createContainerInstance()
      Description copied from class: AbstractRabbitListenerContainerFactory
      Create an empty container instance.
      Specified by:
      createContainerInstance in class AbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>
      the new container instance.
    • initializeContainer

      protected void initializeContainer(DirectMessageListenerContainer instance, RabbitListenerEndpoint endpoint)
      Description copied from class: AbstractRabbitListenerContainerFactory
      Further initialize the specified container.

      Subclasses can inherit from this method to apply extra configuration if necessary.

      initializeContainer in class AbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>
      instance - the container instance to configure.
      endpoint - the endpoint.