Interface AsyncControlClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
JeroMQAsyncControlClient
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Used to open on-demand instances of theControlClient
.static interface
Represents a pending request that thisAsyncControlClient
is making.static interface
Represents a response produced by the remote end.static interface
Response -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this instance ofAsyncControlClient
.closeBinding
(NodeId nodeId, AsyncControlClient.ResponseConsumer<Void> responseConsumer) Issues the command to close a binding.closeRoutesViaInstance
(InstanceId instanceId, String instanceConnectAddress, AsyncControlClient.ResponseConsumer<Void> responseConsumer) Close the routes via theInstanceId
.getInstanceStatus
(AsyncControlClient.ResponseConsumer<InstanceStatus> responseConsumer) Gets theInstanceId
for the remote instance.openBinding
(NodeId nodeId, AsyncControlClient.ResponseConsumer<InstanceConnectionService.InstanceBinding> responseConsumer) Opens anInstanceConnectionService.InstanceBinding
provided theNodeId
and returns theInstanceConnectionService.InstanceBinding
.openRouteToNode
(NodeId nodeId, String instanceInvokerAddress, AsyncControlClient.ResponseConsumer<String> responseConsumer) Issues the command to open up a route to the node.default AsyncControlClient
withDispatch
(Consumer<Runnable> dispatch) Configures thisAsyncControlClient
to dispatch the response handling to the suppliedConsumer<Runnable>
.
-
Method Details
-
getInstanceStatus
AsyncControlClient.Request getInstanceStatus(AsyncControlClient.ResponseConsumer<InstanceStatus> responseConsumer) Gets theInstanceId
for the remote instance.- Parameters:
responseConsumer
- theConsumer<AsyncControlClient.Response<InstanceStatus>>
to handle the request- Returns:
- the
AsyncControlClient.Request
for the instance status
-
openRouteToNode
AsyncControlClient.Request openRouteToNode(NodeId nodeId, String instanceInvokerAddress, AsyncControlClient.ResponseConsumer<String> responseConsumer) Issues the command to open up a route to the node.- Parameters:
nodeId
- theNodeId
instanceInvokerAddress
- the remote instance invoker addressresponseConsumer
- theConsumer<AsyncControlClient.Response<String>>
to handle the request- Returns:
- the connect address for the node
-
closeRoutesViaInstance
AsyncControlClient.Request closeRoutesViaInstance(InstanceId instanceId, String instanceConnectAddress, AsyncControlClient.ResponseConsumer<Void> responseConsumer) Close the routes via theInstanceId
. If no routes are known, then nothing happens.- Parameters:
instanceId
- theInstanceId
-
openBinding
AsyncControlClient.Request openBinding(NodeId nodeId, AsyncControlClient.ResponseConsumer<InstanceConnectionService.InstanceBinding> responseConsumer) Opens anInstanceConnectionService.InstanceBinding
provided theNodeId
and returns theInstanceConnectionService.InstanceBinding
.- Parameters:
nodeId
- theNodeId
- Returns:
- the
InstanceConnectionService.InstanceBinding
-
closeBinding
AsyncControlClient.Request closeBinding(NodeId nodeId, AsyncControlClient.ResponseConsumer<Void> responseConsumer) Issues the command to close a binding. This will invalidate allInstanceConnectionService.InstanceBinding
s to thatNodeId
.- Parameters:
nodeId
-
-
withDispatch
Configures thisAsyncControlClient
to dispatch the response handling to the suppliedConsumer<Runnable>
. There are cases in which it may be desirable to dispatch the actual interactions with a background thread or process. For example the async callbacks to the underlying types may be using one of a few critical IO threads, it would be imperative to avoid blocking such threads. Therefore, the operations may dispatch to the supplied dispatcher.- Parameters:
dispatch
- accepts aRunnable
to run at now or a greater point in time.- Returns:
- a wrapped
AsyncControlClient
which dispatches it's work to the supplied dispatch.
-
close
void close()Closes this instance ofAsyncControlClient
. Any pending tasks will be failed with a callback to any pending responses.- Specified by:
close
in interfaceAutoCloseable
-