Interface QueueConfig

All Known Implementing Classes:
QueueConfigParams

public interface QueueConfig
Defines queue parameters.
Author:
Nikita Koksharov
  • Method Summary

    Modifier and Type
    Method
    Description
    Sets the name of the Dead Letter Queue (DLQ) to which messages that have reached the delivery limit or have been rejected are sent.
    Creates a new QueueConfig instance with default settings.
    delay(Duration delay)
    Sets the delay duration before a message becomes available for consumption after being added to the queue. 0 value means delay duration is not applied.
    deliveryLimit(int value)
    Defines the maximum number of delivery attempts for a message.
    maxMessageSize(int value)
    Sets the maximum allowed size (in bytes) for a single message in the queue.
    maxSize(int value)
    Sets the maximum number of messages that can be stored in the queue.
    Sets the processing mode for the queue which determines how messages are processed by consumers.
    Sets the time-to-live duration for messages in the queue.
    Sets the duration for which a message becomes invisible to other consumers after being polled.
  • Method Details

    • defaults

      static QueueConfig defaults()
      Creates a new QueueConfig instance with default settings.
      Returns:
      config object
    • deliveryLimit

      QueueConfig deliveryLimit(int value)
      Defines the maximum number of delivery attempts for a message. Once this limit is reached, the message may be moved to a dead letter queue if it's configured, otherwise it will be deleted. Can be overridden when adding a message.

      Default value is 10 attempts.

      Parameters:
      value - the maximum number of delivery attempts
      Returns:
      config object
    • visibility

      QueueConfig visibility(Duration value)
      Sets the duration for which a message becomes invisible to other consumers after being polled. This prevents multiple consumers from processing the same message simultaneously. Can be overridden when pooling a message.

      Default value is 30 seconds.

      Parameters:
      value - the visibility timeout duration
      Returns:
      config object
    • timeToLive

      QueueConfig timeToLive(Duration value)
      Sets the time-to-live duration for messages in the queue. Messages will be automatically removed from the queue after this duration expires. 0 value means expiration is not applied. Can be overridden when adding a message.

      Default value is 0.

      Parameters:
      value - the time-to-live duration
      Returns:
      config object
    • deadLetterQueueName

      QueueConfig deadLetterQueueName(String value)
      Sets the name of the Dead Letter Queue (DLQ) to which messages that have reached the delivery limit or have been rejected are sent.

      Dead letter queue can be removed by setting null value.

      Parameters:
      value - the name of the dead letter queue
      Returns:
      config object
    • maxMessageSize

      QueueConfig maxMessageSize(int value)
      Sets the maximum allowed size (in bytes) for a single message in the queue. Messages exceeding this size will be rejected. 0 value means size limit is not applied.

      Default value is 0.

      Parameters:
      value - the maximum message size in bytes
      Returns:
      config object
    • delay

      QueueConfig delay(Duration delay)
      Sets the delay duration before a message becomes available for consumption after being added to the queue. 0 value means delay duration is not applied. Can be overridden when adding a message.

      Default value is 0.

      Parameters:
      delay - the delay duration
      Returns:
      config object
    • maxSize

      QueueConfig maxSize(int value)
      Sets the maximum number of messages that can be stored in the queue. When the queue reaches this size, add messages operation may be blocked and/or return empty result. 0 value means queue size limit is not applied.

      Default value is 0.

      Parameters:
      value - the maximum queue size
      Returns:
      config object
    • processingMode

      QueueConfig processingMode(ProcessingMode mode)
      Sets the processing mode for the queue which determines how messages are processed by consumers.
      Parameters:
      mode - the processing mode
      Returns:
      config object