Interface MessageArgs<V>

Type Parameters:
V - type
All Known Implementing Classes:
MessageParams

public interface MessageArgs<V>
Fluent API interface defining parameters for a message in a queue.
Author:
Nikita Koksharov
  • Method Details

    • priority

      MessageArgs<V> priority(int priority)
      Sets the priority level for the message. Defined as a number between 0 and 9

      0 is the lowest priority level.

      9 is the highest priority level.

      Default value is 0.

      Parameters:
      priority - the priority level
      Returns:
      arguments object
    • delay

      MessageArgs<V> delay(Duration interval)
      Sets a delay interval before the message becomes available for processing.

      0 value means delay duration is not applied. If not defined, the queue's delay setting value is used. If queue's delay setting is also not set, the default value is 0.

      Parameters:
      interval - the time duration to delay message delivery
      Returns:
      arguments object
    • deduplicationByHash

      MessageArgs<V> deduplicationByHash(Duration interval)
      Enables deduplication based on the payload hash for the specified interval.

      During the specified interval, messages with the same hash will be considered duplicates and won't be added to the queue.

      Parameters:
      interval - the time duration
      Returns:
      arguments object
    • deduplicationById

      MessageArgs<V> deduplicationById(Object id, Duration interval)
      Enables deduplication based on a custom ID for the specified interval.

      During the specified interval, messages with the same ID will be considered duplicates and won't be added to the queue.

      Parameters:
      id - the custom identifier
      interval - the time duration
      Returns:
      arguments object
    • timeToLive

      MessageArgs<V> timeToLive(Duration value)
      Sets the time-to-live duration for the message.

      After this duration has elapsed, the message is removed from the queue if it hasn't been processed.

      0 value means expiration is not applied. If not defined, the queue's timeToLive setting value is used. If queue's timeToLive setting is also not set, the default value is 0.

      Parameters:
      value - the time duration
      Returns:
      arguments object
    • deliveryLimit

      MessageArgs<V> deliveryLimit(int count)
      Sets the maximum number of delivery attempts for the message.

      If processing the message fails, it may be redelivered up to the specified count.

      The minimum value is 1. If not defined, the queue's deliveryLimit setting value is used. If queue's deliveryLimit setting is also not set, the default value is 10.
      Parameters:
      count - the maximum number of delivery attempts
      Returns:
      arguments object
    • header

      MessageArgs<V> header(String key, Object value)
      Adds a single header entry to the message.
      Parameters:
      key - the header key
      value - the header value
      Returns:
      arguments object
    • headers

      MessageArgs<V> headers(Map<String,Object> entries)
      Adds multiple header entries to the message at once.
      Parameters:
      entries - a map containing header key-value pairs
      Returns:
      arguments object
    • payload

      static <V> MessageArgs<V> payload(V value)
      Defines the payload to include in the message
      Parameters:
      value - the payload to include
      Returns:
      arguments object