Package io.atomix.cluster.messaging.impl
Class NettyUnicastService
java.lang.Object
io.atomix.cluster.messaging.impl.NettyUnicastService
- All Implemented Interfaces:
ManagedUnicastService,UnicastService,Managed<UnicastService>
Netty unicast service.
-
Constructor Summary
ConstructorsConstructorDescriptionNettyUnicastService(String clusterId, Address address, MessagingConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(String subject, BiConsumer<Address, byte[]> listener, Executor executor) Adds a broadcast listener for the given subject.booleanvoidremoveListener(String subject, BiConsumer<Address, byte[]> listener) Removes a broadcast listener for the given subject.start()stop()voidBroadcasts the given message to all listeners for the given subject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.atomix.cluster.messaging.UnicastService
addListener
-
Constructor Details
-
NettyUnicastService
-
-
Method Details
-
unicast
Description copied from interface:UnicastServiceBroadcasts 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:
unicastin interfaceUnicastService- Parameters:
address- the address to which to unicast the messagesubject- the message subjectpayload- the message to broadcast
-
addListener
Description copied from interface:UnicastServiceAdds 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.- Specified by:
addListenerin interfaceUnicastService- Parameters:
subject- the message subjectlistener- the broadcast listener to addexecutor- an executor with which to call the listener
-
removeListener
Description copied from interface:UnicastServiceRemoves a broadcast listener for the given subject.- Specified by:
removeListenerin interfaceUnicastService- Parameters:
subject- the message subjectlistener- the broadcast listener to remove
-
start
- Specified by:
startin interfaceManaged<UnicastService>
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceManaged<UnicastService>
-
stop
- Specified by:
stopin interfaceManaged<UnicastService>
-