Interface AsyncControlClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
JeroMQAsyncControlClient
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceUsed to open on-demand instances of theControlClient.static interfaceRepresents a pending request that thisAsyncControlClientis making.static interfaceRepresents a response produced by the remote end.static interfaceResponse -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 theInstanceIdfor the remote instance.openBinding(NodeId nodeId, AsyncControlClient.ResponseConsumer<InstanceConnectionService.InstanceBinding> responseConsumer) Opens anInstanceConnectionService.InstanceBindingprovided theNodeIdand returns theInstanceConnectionService.InstanceBinding.openRouteToNode(NodeId nodeId, String instanceInvokerAddress, AsyncControlClient.ResponseConsumer<String> responseConsumer) Issues the command to open up a route to the node.default AsyncControlClientwithDispatch(Consumer<Runnable> dispatch) Configures thisAsyncControlClientto dispatch the response handling to the suppliedConsumer<Runnable>.
-
Method Details
-
getInstanceStatus
AsyncControlClient.Request getInstanceStatus(AsyncControlClient.ResponseConsumer<InstanceStatus> responseConsumer) Gets theInstanceIdfor the remote instance.- Parameters:
responseConsumer- theConsumer<AsyncControlClient.Response<InstanceStatus>>to handle the request- Returns:
- the
AsyncControlClient.Requestfor 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- theNodeIdinstanceInvokerAddress- 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.InstanceBindingprovided theNodeIdand 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.InstanceBindings to thatNodeId.- Parameters:
nodeId-
-
withDispatch
Configures thisAsyncControlClientto 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 aRunnableto run at now or a greater point in time.- Returns:
- a wrapped
AsyncControlClientwhich 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:
closein interfaceAutoCloseable
-