ChannelListener (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.catalina.tribes, interface: ChannelListener

# Interface ChannelListener

All Known Subinterfaces:
  `ClusterDeployer`

All Known Implementing Classes:
  `AbstractReplicatedMap, CloudMembershipProvider, ClusterListener, ClusterSessionListener, DNSMembershipProvider, FarmWarDeployer, KubernetesMembershipProvider, LazyReplicatedMap, ReplicatedMap, RpcChannel, SimpleTcpCluster, StaticMembershipProvider`

public interface ChannelListener
An interface to listens to incoming messages from a channel.

When a message is received, the Channel will invoke the channel listener in a conditional sequence. `if (listener.accept(msg,sender)) listener.messageReceived(msg,sender);`

A ChannelListener implementation MUST NOT return true on `accept(Serializable, Member)` if it doesn't intend to process the message. The channel can this way track whether a message was processed by an above application or if it was just received and forgot about, a feature required to support message-response(RPC) calls

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(Serializable msg, Member sender)`
  Invoked by the channel to determine if the listener will process this message or not.
  `void`
  `messageReceived(Serializable msg, Member sender)`
  Receive a message from the channel

- ## Method Details

  - ### messageReceived

    void messageReceived(Serializable msg, Member sender)
    Receive a message from the channel
    Parameters:
      `msg` - Serializable
      `sender` - - the source of the message

  - ### accept

    boolean accept(Serializable msg, Member sender)
    Invoked by the channel to determine if the listener will process this message or not.
    Parameters:
      `msg` - Serializable
      `sender` - Member
    Returns:
      boolean