Class NettyUnicastService

java.lang.Object
io.atomix.cluster.messaging.impl.NettyUnicastService
All Implemented Interfaces:
ManagedUnicastService, UnicastService, Managed<UnicastService>

public class NettyUnicastService extends Object implements ManagedUnicastService
Netty unicast service.
  • Constructor Details

  • Method Details

    • unicast

      public void unicast(Address address, String subject, byte[] payload)
      Description copied from interface: UnicastService
      Broadcasts the given message to all listeners for the given subject.

      The message will be broadcast to all listeners for the given subject. This service makes no guarantee regarding the reliability or order of delivery of the message.

      Specified by:
      unicast in interface UnicastService
      Parameters:
      address - the address to which to unicast the message
      subject - the message subject
      payload - the message to broadcast
    • addListener

      public void addListener(String subject, BiConsumer<Address,byte[]> listener, Executor executor)
      Description copied from interface: UnicastService
      Adds a broadcast listener for the given subject.

      Messages broadcast to the given subject will be delivered to the provided listener. This service provides no guarantee regarding the order in which messages arrive.

      Specified by:
      addListener in interface UnicastService
      Parameters:
      subject - the message subject
      listener - the broadcast listener to add
      executor - an executor with which to call the listener
    • removeListener

      public void removeListener(String subject, BiConsumer<Address,byte[]> listener)
      Description copied from interface: UnicastService
      Removes a broadcast listener for the given subject.
      Specified by:
      removeListener in interface UnicastService
      Parameters:
      subject - the message subject
      listener - the broadcast listener to remove
    • start

      Specified by:
      start in interface Managed<UnicastService>
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Managed<UnicastService>
    • stop

      public CompletableFuture<Void> stop()
      Specified by:
      stop in interface Managed<UnicastService>