public interface MessagingService
Modifier and Type | Method and Description |
---|---|
void |
registerHandler(java.lang.String type,
java.util.function.BiConsumer<Endpoint,byte[]> handler,
java.util.concurrent.Executor executor)
Registers a new message handler for message type.
|
void |
registerHandler(java.lang.String type,
java.util.function.BiFunction<Endpoint,byte[],byte[]> handler,
java.util.concurrent.Executor executor)
Registers a new message handler for message type.
|
void |
registerHandler(java.lang.String type,
java.util.function.BiFunction<Endpoint,byte[],java.util.concurrent.CompletableFuture<byte[]>> handler)
Registers a new message handler for message type.
|
java.util.concurrent.CompletableFuture<byte[]> |
sendAndReceive(Endpoint ep,
java.lang.String type,
byte[] payload)
Sends a message asynchronously and expects a response.
|
java.util.concurrent.CompletableFuture<byte[]> |
sendAndReceive(Endpoint ep,
java.lang.String type,
byte[] payload,
java.util.concurrent.Executor executor)
Sends a message synchronously and expects a response.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
sendAsync(Endpoint ep,
java.lang.String type,
byte[] payload)
Sends a message asynchronously to the specified communication end point.
|
void |
unregisterHandler(java.lang.String type)
Unregister current handler, if one exists for message type.
|
java.util.concurrent.CompletableFuture<java.lang.Void> sendAsync(Endpoint ep, java.lang.String type, byte[] payload)
ep
- end point to send the message to.type
- type of message.payload
- message payload bytes.java.util.concurrent.CompletableFuture<byte[]> sendAndReceive(Endpoint ep, java.lang.String type, byte[] payload)
ep
- end point to send the message to.type
- type of message.payload
- message payload.java.util.concurrent.CompletableFuture<byte[]> sendAndReceive(Endpoint ep, java.lang.String type, byte[] payload, java.util.concurrent.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(java.lang.String type, java.util.function.BiConsumer<Endpoint,byte[]> handler, java.util.concurrent.Executor executor)
type
- message type.handler
- message handlerexecutor
- executor to use for running message handler logic.void registerHandler(java.lang.String type, java.util.function.BiFunction<Endpoint,byte[],byte[]> handler, java.util.concurrent.Executor executor)
type
- message type.handler
- message handlerexecutor
- executor to use for running message handler logic.void registerHandler(java.lang.String type, java.util.function.BiFunction<Endpoint,byte[],java.util.concurrent.CompletableFuture<byte[]>> handler)
type
- message type.handler
- message handlervoid unregisterHandler(java.lang.String type)
type
- message type