Package io.atomix.cluster.messaging
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 interfaceBroadcastService.BuilderBroadcast service builder. -
Method Summary
Modifier and Type Method Description voidaddListener(String subject, java.util.function.Consumer<byte[]> listener)Adds a broadcast listener for the given subject.voidbroadcast(String subject, byte[] message)Broadcasts the given message to all listeners for the given subject.voidremoveListener(String subject, java.util.function.Consumer<byte[]> listener)Removes a broadcast listener for the given subject.
-
Method Details
-
broadcast
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 subjectmessage- the message to broadcast
-
addListener
Adds a broadcast listener for the given subject.Messages broadcast to the given
subjectwill be delivered to the provided listener. This service provides no guarantee regarding the order in which messages arrive.- Parameters:
subject- the message subjectlistener- the broadcast listener to add
-
removeListener
Removes a broadcast listener for the given subject.- Parameters:
subject- the message subjectlistener- the broadcast listener to remove
-