Interface AQMessageProperties


  • public interface AQMessageProperties
    This interface contains the message properties such as Correlation, Sender, Delay and Expiration, Recipients, and Priority and Ordering. Some of these properties such as the enqueue timestamp or the count of dequeue attempts cannot be set by the user: they are retrieved from the server during a dequeue operation.

    When enqueuing a new message in a queue, you first need to retrieve a new instance of this interface by calling AQFactory.createAQMessageProperties(). Fill the message properties and then call AQFactory.createAQMessage(props) to create a new AQ message with props being the message properties. Finally set the payload and then enqueue the message.

    Since:
    11.1
    See Also:
    AQFactory.createAQMessageProperties
  • <section role="region">
    • Field Detail

      • MESSAGE_NO_DELAY

        static final int MESSAGE_NO_DELAY
        Possible value for setDelay. Indicates the message is available for immediate dequeuing.
        See Also:
        Constant Field Values
      • MESSAGE_NO_EXPIRATION

        static final int MESSAGE_NO_EXPIRATION
        The message will never expire. Can be used for setExpiration().
        See Also:
        Constant Field Values
    </section> <section role="region">
    • Method Detail

      • getDequeueAttemptsCount

        int getDequeueAttemptsCount()
        Returns the number of attempts that have been made to dequeue the message.
      • setCorrelation

        void setCorrelation​(String correlation)
                     throws SQLException
        Specifies the identification supplied by the producer for a message at enqueuing.
        Throws:
        SQLException
      • getCorrelation

        String getCorrelation()
      • setDelay

        void setDelay​(int delay)
               throws SQLException
        Specifies the number of seconds to delay the enqueued message. The delay represents the number of seconds after which a message is available for dequeuing. Dequeuing by msgid overrides the delay specification. A message enqueued with delay set will be in the WAITING state, when the delay expires the messages goes to the READY state. DELAY processing requires the queue monitor to be started. Note that delay is set by the producer who enqueues the message.
        Throws:
        SQLException
      • getDelay

        int getDelay()
      • getEnqueueTime

        Timestamp getEnqueueTime()
        Returns the time the message was enqueued. This value is determined by the system and cannot be set by the user.
      • setExceptionQueue

        void setExceptionQueue​(String exceptionQueue)
                        throws SQLException
        Specifies the name of the queue to which the message is moved to if it cannot be processed successfully. Messages are moved in two cases: If the number of unsuccessful dequeue attempts has exceeded max_retries; or if the message has expired. All messages in the exception queue are in the EXPIRED state. The default is the exception queue associated with the queue table. If the exception queue specified does not exist at the time of the move the message will be moved to the default exception queue associated with the queue table and a warning will be logged in the alert file. If the default exception queue is used, the parameter will return a NULL value at dequeue time. This attribute must refer to a valid queue name.
        Throws:
        SQLException
      • getExceptionQueue

        String getExceptionQueue()
      • setExpiration

        void setExpiration​(int seconds)
                    throws SQLException
        Specifies the expiration of the message. It determines, in seconds, the duration the message is available for dequeuing. This parameter is an offset from the delay. Expiration processing requires the queue monitor to be running. While waiting for expiration, the message remains in the READY state. If the message is not dequeued before it expires, it will be moved to the exception queue in the EXPIRED state.
        Throws:
        SQLException
      • getExpiration

        int getExpiration()
      • getState

        AQMessageProperties.MessageState getState()
        Returns the state of the message at the time of the dequeue. This parameter cannot be set at enqueue time.
      • setPriority

        void setPriority​(int priority)
                  throws SQLException
        Specifies the priority of the message. A smaller number indicates higher priority. The priority can be any number, including negative numbers. The default value is zero.
        Throws:
        SQLException
      • getPriority

        int getPriority()
      • setRecipientList

        void setRecipientList​(AQAgent[] agents)
                       throws SQLException
        This parameter is only valid for queues which allow multiple consumers. The default recipients are the queue subscribers but they can be overriden using this method. This parameter is not returned to a consumer at dequeue time.
        Throws:
        SQLException
      • getRecipientList

        AQAgent[] getRecipientList()
      • getTransactionGroup

        String getTransactionGroup()
        For transaction-grouped queues, this identifies the transaction group of the message. This attribute is populated after a successful dequeueArray() call. All messages in a group have the same value for this attribute. This attribute cannot be used by the enqueueArray() call to set the transaction group for an enqueued message.
      • getPreviousQueueMessageId

        byte[] getPreviousQueueMessageId()
        The ID of the message in the last queue that generated this message. When a message is propagated from one queue to another, this attribute identifies the ID of the queue from which it was last propagated. When a message has been propagated through multiple queues, this attribute identifies the ID of the message in the last queue that generated this message, not the first queue.
      • getDeliveryMode

        AQMessageProperties.DeliveryMode getDeliveryMode()
        After a dequeue operation, call this method to find out if the message was enqueued in a persistent manner or not.

        Note that this is set at dequeue time by the driver. There is an enqueue option to enqueue a buffered message.

    </section>