public interface ClusterCommunicationService
Modifier and Type | Method and Description |
---|---|
void |
addSubscriber(MessageSubject subject,
ClusterMessageHandler subscriber,
ExecutorService executor)
Deprecated.
in Cardinal Release
|
<M> void |
addSubscriber(MessageSubject subject,
Function<byte[],M> decoder,
Consumer<M> handler,
Executor executor)
Adds a new subscriber for the specified message subject.
|
<M,R> void |
addSubscriber(MessageSubject subject,
Function<byte[],M> decoder,
Function<M,CompletableFuture<R>> handler,
Function<R,byte[]> encoder)
Adds a new subscriber for the specified message subject.
|
<M,R> void |
addSubscriber(MessageSubject subject,
Function<byte[],M> decoder,
Function<M,R> handler,
Function<R,byte[]> encoder,
Executor executor)
Adds a new subscriber for the specified message subject.
|
<M> void |
broadcast(M message,
MessageSubject subject,
Function<M,byte[]> encoder)
Broadcasts a message to all controller nodes.
|
<M> void |
broadcastIncludeSelf(M message,
MessageSubject subject,
Function<M,byte[]> encoder)
Broadcasts a message to all controller nodes including self.
|
<M> void |
multicast(M message,
MessageSubject subject,
Function<M,byte[]> encoder,
Set<NodeId> nodeIds)
Multicasts a message to a set of controller nodes.
|
void |
removeSubscriber(MessageSubject subject)
Removes a subscriber for the specified message subject.
|
<M,R> CompletableFuture<R> |
sendAndReceive(M message,
MessageSubject subject,
Function<M,byte[]> encoder,
Function<byte[],R> decoder,
NodeId toNodeId)
Sends a message and expects a reply.
|
<M> CompletableFuture<Void> |
unicast(M message,
MessageSubject subject,
Function<M,byte[]> encoder,
NodeId toNodeId)
Sends a message to the specified controller node.
|
@Deprecated void addSubscriber(MessageSubject subject, ClusterMessageHandler subscriber, ExecutorService executor)
subject
- message subjectsubscriber
- message subscriberexecutor
- executor to use for running handler.<M> void broadcast(M message, MessageSubject subject, Function<M,byte[]> encoder)
M
- message typemessage
- message to sendsubject
- message subjectencoder
- function for encoding message to byte[]<M> void broadcastIncludeSelf(M message, MessageSubject subject, Function<M,byte[]> encoder)
M
- message typemessage
- message to sendsubject
- message subjectencoder
- function for encoding message to byte[]<M> CompletableFuture<Void> unicast(M message, MessageSubject subject, Function<M,byte[]> encoder, NodeId toNodeId)
M
- message typemessage
- message to sendsubject
- message subjectencoder
- function for encoding message to byte[]toNodeId
- destination node identifier<M> void multicast(M message, MessageSubject subject, Function<M,byte[]> encoder, Set<NodeId> nodeIds)
M
- message typemessage
- message to sendsubject
- message subjectencoder
- function for encoding message to byte[]nodeIds
- recipient node identifiers<M,R> CompletableFuture<R> sendAndReceive(M message, MessageSubject subject, Function<M,byte[]> encoder, Function<byte[],R> decoder, NodeId toNodeId)
M
- request typeR
- reply typemessage
- message to sendsubject
- message subjectencoder
- function for encoding request to byte[]decoder
- function for decoding response from byte[]toNodeId
- recipient node identifier<M,R> void addSubscriber(MessageSubject subject, Function<byte[],M> decoder, Function<M,R> handler, Function<R,byte[]> encoder, Executor executor)
M
- incoming message typeR
- reply message typesubject
- message subjectdecoder
- decoder for resurrecting incoming messagehandler
- handler function that processes the incoming message and produces a replyencoder
- encoder for serializing replyexecutor
- executor to run this handler on<M,R> void addSubscriber(MessageSubject subject, Function<byte[],M> decoder, Function<M,CompletableFuture<R>> handler, Function<R,byte[]> encoder)
M
- incoming message typeR
- reply message typesubject
- message subjectdecoder
- decoder for resurrecting incoming messagehandler
- handler function that processes the incoming message and produces a replyencoder
- encoder for serializing reply<M> void addSubscriber(MessageSubject subject, Function<byte[],M> decoder, Consumer<M> handler, Executor executor)
M
- incoming message typesubject
- message subjectdecoder
- decoder to resurrecting incoming messagehandler
- handler for handling messageexecutor
- executor to run this handler onvoid removeSubscriber(MessageSubject subject)
subject
- message subject