com.hazelcast.core

## Interface MessageListener<E>

- Type Parameters:
    `E` - message
  All Superinterfaces:
    EventListener
  All Known Subinterfaces:
    ReliableMessageListener<E>
  All Known Implementing Classes:
    ClientConsoleApp, ConsoleApp

      public interface MessageListener<E>
      extends EventListener

  Message listener for `ITopic`. Provided that a MessageListener is not registered twice, a MessageListener will never be called concurrently. So there is no need to provide thread-safety on internal state in the MessageListener. Also there is no need to enforce safe publication, the ITopic is responsible for the memory consistency effects. In other words, there is no need to make internal fields of the MessageListener volatile or access them using synchronized blocks.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onMessage(Message<E> message)` Invoked when a message is received for the added topic.

- - ### Method Detail

    - #### onMessage

          void onMessage(Message<E> message)

      Invoked when a message is received for the added topic. Note that topic guarantees message ordering. Therefore there is only one thread invoking onMessage. The user should not keep the thread busy, but preferably should dispatch it via an Executor. This will increase the performance of the topic.
      Parameters:
        `message` - the message that is received for the added topic

Copyright © 2020. All rights reserved.