Interface MessageListener<T>

All Superinterfaces:
Serializable

public interface MessageListener<T> extends Serializable
A listener that will be called in order for every message received.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Get the notification when a topic is terminated.
    void
    received(Consumer consumer, org.apache.pulsar.client.api.Message<T> msg)
    This method is called whenever a new message is received.
  • Method Details

    • received

      void received(Consumer consumer, org.apache.pulsar.client.api.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. Implementation should acknowledge messages by calling consumer.acknowledge(msg). Application is responsible of handling any exception that could be thrown while processing the message.
      Parameters:
      consumer - the consumer that received the message
      msg - the message object
    • reachedEndOfTopic

      default void reachedEndOfTopic(Consumer consumer)
      Get the notification when a topic is terminated.
      Parameters:
      consumer - the Consumer object associated with the terminated topic