Class ConsumeFromQueue

    • Constructor Detail

      • ConsumeFromQueue

        public ConsumeFromQueue​(String consumerName,
                                QueueName queueName,
                                RedeliveryPolicy redeliveryPolicy,
                                int parallelConsumers,
                                QueuedMessageHandler queueMessageHandler,
                                Duration pollingInterval)
        Start an asynchronous message consumer.
        Note: There can only be one DurableQueueConsumer per QueueName per DurableQueues instance
        Parameters:
        consumerName - the name of the consumer (for logging purposes)
        queueName - the name of the queue that the consumer will be listening for queued messages ready to be delivered to the QueuedMessageHandler provided
        redeliveryPolicy - the redelivery policy in case the handling of a message fails
        parallelConsumers - the number of parallel consumers (if number > 1 then you will effectively have competing consumers on the current node)
        queueMessageHandler - the message handler that will receive QueuedMessage's. See PatternMatchingQueuedMessageHandler
        pollingInterval - the interval with which the consumer poll the queue db for new messages to process
      • ConsumeFromQueue

        public ConsumeFromQueue​(String consumerName,
                                QueueName queueName,
                                RedeliveryPolicy redeliveryPolicy,
                                int parallelConsumers,
                                ScheduledExecutorService consumerExecutorService,
                                QueuedMessageHandler queueMessageHandler,
                                Duration pollingInterval)
        Start an asynchronous message consumer.
        Note: There can only be one DurableQueueConsumer per QueueName per DurableQueues instance
        Parameters:
        consumerName - the name of the consumer (for logging purposes)
        queueName - the name of the queue that the consumer will be listening for queued messages ready to be delivered to the QueuedMessageHandler provided
        redeliveryPolicy - the redelivery policy in case the handling of a message fails
        parallelConsumers - the number of parallel consumers (if number > 1 then you will effectively have competing consumers on the current node)
        consumerExecutorService - the optional ScheduledExecutorService that's responsible for scheduling the parallelConsumers. Also see ThreadFactoryBuilder
        queueMessageHandler - the message handler that will receive QueuedMessage's. See PatternMatchingQueuedMessageHandler
        pollingInterval - the interval with which the consumer poll the queue db for new messages to process
      • ConsumeFromQueue

        public ConsumeFromQueue​(String consumerName,
                                QueueName queueName,
                                RedeliveryPolicy redeliveryPolicy,
                                int parallelConsumers,
                                Optional<ScheduledExecutorService> consumerExecutorService,
                                QueuedMessageHandler queueMessageHandler,
                                Duration pollingInterval)
        Start an asynchronous message consumer.
        Note: There can only be one DurableQueueConsumer per QueueName per DurableQueues instance
        Parameters:
        consumerName - the name of the consumer (for logging purposes)
        queueName - the name of the queue that the consumer will be listening for queued messages ready to be delivered to the QueuedMessageHandler provided
        redeliveryPolicy - the redelivery policy in case the handling of a message fails
        parallelConsumers - the number of parallel consumers (if number > 1 then you will effectively have competing consumers on the current node)
        consumerExecutorService - the optional ScheduledExecutorService that's responsible for scheduling the parallelConsumers. Also see ThreadFactoryBuilder
        queueMessageHandler - the message handler that will receive QueuedMessage's. See PatternMatchingQueuedMessageHandler
        pollingInterval - the interval with which the consumer poll the queue db for new messages to process
    • Method Detail

      • getConsumerName

        public String getConsumerName()
        Returns:
        the consumer name (for logging purposes)
      • getPollingInterval

        public Duration getPollingInterval()
        Returns:
        the interval with which the consumer poll the queue db for new messages to process
      • getRedeliveryPolicy

        public RedeliveryPolicy getRedeliveryPolicy()
        Returns:
        the redelivery policy in case the handling of a message fails
      • setRedeliveryPolicy

        public void setRedeliveryPolicy​(RedeliveryPolicy redeliveryPolicy)
        Parameters:
        redeliveryPolicy - the redelivery policy in case the handling of a message fails
      • getQueueName

        public QueueName getQueueName()
        Returns:
        the name of the queue that the consumer will be listening for queued messages ready to be delivered to the QueuedMessageHandler provided
      • getParallelConsumers

        public int getParallelConsumers()
        Returns:
        the number of parallel consumers (if number > 1 then you will effectively have competing consumers on the current node)
      • validate

        public void validate()