Package io.atomix.cluster.messaging
Interface UnicastService
- All Known Subinterfaces:
ManagedUnicastService
- All Known Implementing Classes:
NettyUnicastService
public interface UnicastService
Service for unreliable unicast 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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddListener(String subject, BiConsumer<Address, byte[]> listener) Adds a broadcast listener for the given subject.voidaddListener(String subject, BiConsumer<Address, byte[]> listener, Executor executor) Adds a broadcast listener for the given subject.voidremoveListener(String subject, BiConsumer<Address, byte[]> listener) Removes a broadcast listener for the given subject.voidBroadcasts the given message to all listeners for the given subject.
-
Method Details
-
unicast
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:
address- the address to which to unicast the messagesubject- 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
-
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 addexecutor- an executor with which to call the listener
-
removeListener
Removes a broadcast listener for the given subject.- Parameters:
subject- the message subjectlistener- the broadcast listener to remove
-