Interface BroadcastService

All Known Subinterfaces:
ManagedBroadcastService

public interface BroadcastService
Service for broadcast messaging between nodes.

The broadcast service is an unreliable broadcast messaging service backed by multicast. This service provides no guaranteed regarding reliability or order of messages.

  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static interface  BroadcastService.Builder
    Broadcast service builder.
  • Method Summary

    Modifier and Type Method Description
    void addListener​(String subject, java.util.function.Consumer<byte[]> listener)
    Adds a broadcast listener for the given subject.
    void broadcast​(String subject, byte[] message)
    Broadcasts the given message to all listeners for the given subject.
    void removeListener​(String subject, java.util.function.Consumer<byte[]> listener)
    Removes a broadcast listener for the given subject.
  • Method Details

    • broadcast

      void broadcast​(String subject, byte[] message)
      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.

      Parameters:
      subject - the message subject
      message - the message to broadcast
    • addListener

      void addListener​(String subject, java.util.function.Consumer<byte[]> listener)
      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.

      Parameters:
      subject - the message subject
      listener - the broadcast listener to add
    • removeListener

      void removeListener​(String subject, java.util.function.Consumer<byte[]> listener)
      Removes a broadcast listener for the given subject.
      Parameters:
      subject - the message subject
      listener - the broadcast listener to remove