接口 MessageListener<T>

所有超级接口:
Serializable

@Public @Stable public interface MessageListener<T> extends Serializable
A listener that will be called in order for every message received.
  • 方法概要

    修饰符和类型
    方法
    说明
    default void
    Get the notification when a topic is terminated.
    void
    received(Consumer<T> consumer, Message<T> msg)
    This method is called whenever a new message is received.
  • 方法详细资料

    • received

      void received(Consumer<T> consumer, Message<T> msg)
      This method is called whenever a new message is received.

      Messages are guaranteed to be delivered in order and from the same thread for a single consumer

      This method will only be called once for each message, unless either application or broker crashes.

      Application is responsible for acking message by calling any of consumer acknowledgement methods.

      Application is responsible of handling any exception that could be thrown while processing the message.

      参数:
      consumer - the consumer that received the message
      msg - the message object
    • reachedEndOfTopic

      default void reachedEndOfTopic(Consumer<T> consumer)
      Get the notification when a topic is terminated.
      参数:
      consumer - the Consumer object associated with the terminated topic