Interface MessageHandler.Context

  • Enclosing interface:
    MessageHandler

    public static interface MessageHandler.Context
    Information about the message.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long committedChunkId()
      The ID (offset) of the committed chunk (block of messages) in the stream.
      Consumer consumer()
      The consumer that receives the message.
      long offset()
      The offset of the message in the stream.
      void processed()
      Mark the message as processed, potentially asking for more messages from the broker.
      void storeOffset()
      Shortcut to send a store order for the message offset.
      String stream()
      The stream the message comes from.
      long timestamp()
      The timestamp of the message chunk.
    • Method Detail

      • offset

        long offset()
        The offset of the message in the stream.
        Returns:
        the offset of the current message
      • storeOffset

        void storeOffset()
        Shortcut to send a store order for the message offset.
        See Also:
        Consumer.store(long)
      • timestamp

        long timestamp()
        The timestamp of the message chunk.
        Returns:
        the timestamp of the message chunk
      • committedChunkId

        long committedChunkId()
        The ID (offset) of the committed chunk (block of messages) in the stream.

        It is the offset of the first message in the last chunk confirmed by a quorum of the stream cluster members (leader and replicas).

        The committed chunk ID is a good indication of what the last offset of a stream can be at a given time. The value can be stale as soon as the application reads it though, as the committed chunk ID for a stream that is published to changes all the time.

        This requires RabbitMQ 3.11 or more. The method always returns 0 otherwise.

        Returns:
        committed chunk ID in this stream
        See Also:
        StreamStats.committedChunkId()
      • stream

        String stream()
        The stream the message comes from.
        Returns:
        the stream the message comes from