public interface MessagingService
| Modifier and Type | Method and Description |
|---|---|
void |
registerHandler(String type,
BiConsumer<Endpoint,byte[]> handler,
Executor executor)
Registers a new message handler for message type.
|
void |
registerHandler(String type,
BiFunction<Endpoint,byte[],byte[]> handler,
Executor executor)
Registers a new message handler for message type.
|
void |
registerHandler(String type,
BiFunction<Endpoint,byte[],CompletableFuture<byte[]>> handler)
Registers a new message handler for message type.
|
CompletableFuture<byte[]> |
sendAndReceive(Endpoint ep,
String type,
byte[] payload)
Sends a message asynchronously and expects a response.
|
CompletableFuture<byte[]> |
sendAndReceive(Endpoint ep,
String type,
byte[] payload,
Executor executor)
Sends a message synchronously and expects a response.
|
CompletableFuture<Void> |
sendAsync(Endpoint ep,
String type,
byte[] payload)
Sends a message asynchronously to the specified communication end point.
|
void |
unregisterHandler(String type)
Unregister current handler, if one exists for message type.
|
CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload)
ep - end point to send the message to.type - type of message.payload - message payload bytes.CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload)
ep - end point to send the message to.type - type of message.payload - message payload.CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload, Executor executor)
ep - end point to send the message to.type - type of message.payload - message payload.executor - executor over which any follow up actions after completion will be executed.void registerHandler(String type, BiConsumer<Endpoint,byte[]> handler, Executor executor)
type - message type.handler - message handlerexecutor - executor to use for running message handler logic.void registerHandler(String type, BiFunction<Endpoint,byte[],byte[]> handler, Executor executor)
type - message type.handler - message handlerexecutor - executor to use for running message handler logic.void registerHandler(String type, BiFunction<Endpoint,byte[],CompletableFuture<byte[]>> handler)
type - message type.handler - message handlervoid unregisterHandler(String type)
type - message type