Class JeroMQRemoteInvoker
java.lang.Object
dev.getelements.elements.rt.remote.jeromq.JeroMQRemoteInvoker
- All Implemented Interfaces:
RemoteInvoker
-
Field Summary
Fields inherited from interface dev.getelements.elements.rt.remote.RemoteInvoker
DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_UNITS, REMOTE_INVOKER_MAX_CONNECTIONS, REMOTE_INVOKER_MIN_CONNECTIONS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsyncConnectionService
<org.zeromq.ZContext, org.zeromq.ZMQ.Socket> Gets the connection address for thisRemoteInvoker
.int
int
invokeAsync
(Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocation
to the remote service and waits for theInvocationResult
.invokeCompletionStage
(Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Sends theInvocation
to the remote service and waits for theInvocationResult
.void
setAsyncConnectionService
(AsyncConnectionService<org.zeromq.ZContext, org.zeromq.ZMQ.Socket> asyncConnectionService) void
setMaxConnections
(int maxConnections) void
setMinConnections
(int minConnections) void
setPayloadReader
(PayloadReader payloadReader) void
setPayloadWriter
(PayloadWriter payloadWriter) void
Starts up thin is complete.void
stop()
Stops thisRemoteInvoker
.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.getelements.elements.rt.remote.RemoteInvoker
invoke, invokeAsyncV, invokeFuture, invokeSync, start
-
Constructor Details
-
JeroMQRemoteInvoker
public JeroMQRemoteInvoker()
-
-
Method Details
-
getConnectAddress
Description copied from interface:RemoteInvoker
Gets the connection address for thisRemoteInvoker
. This should be the last value passed toRemoteInvoker.start(String)
orRemoteInvoker.start(String, long, TimeUnit)
.- Specified by:
getConnectAddress
in interfaceRemoteInvoker
- Returns:
- the connect address
-
start
Description copied from interface:RemoteInvoker
Starts up thin is complete. The default implementation of this method does nothing in case no setup is necessary.- Specified by:
start
in interfaceRemoteInvoker
-
stop
public void stop()Description copied from interface:RemoteInvoker
Stops thisRemoteInvoker
. This method must gracefully shut down all connections and stop any worker threads. THe default implementation of this method does nothing in case no shutdown is necessary.- Specified by:
stop
in interfaceRemoteInvoker
-
invokeAsync
public AsyncOperation invokeAsync(Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RemoteInvoker
Sends theInvocation
to the remote service and waits for theInvocationResult
. The suppliedConsumer<InvocationError>
will relay all encountered errors. Typically this is used with theDispatch.Type.ASYNCHRONOUS
. This returns the generic Void type to clarify the intention of the method that the underlyingFuture
is discarded, but since is is intended to be used with reflections code, this allows for the method to be easily adapted as such.- Specified by:
invokeAsync
in interfaceRemoteInvoker
- Parameters:
invocation
- the outgoingInvocation
asyncInvocationResultConsumerList
- aList<Consumer<InvocationResult>>
to capture all async resultsasyncInvocationErrorConsumer
- aConsumer<InvocationError>
to receive async errors- Returns:
- an instance of
AsyncOperation
-
invokeCompletionStage
public CompletionStage<Object> invokeCompletionStage(Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RemoteInvoker
Sends theInvocation
to the remote service and waits for theInvocationResult
. The suppliedConsumer<InvocationError>
will relay all encountered errors. Typically this is used with theDispatch.Type.FUTURE
- Specified by:
invokeCompletionStage
in interfaceRemoteInvoker
- Parameters:
invocation
- the outgoingInvocation
asyncInvocationResultConsumerList
- aList<Consumer<InvocationResult>>
to capture all async resultsasyncInvocationErrorConsumer
- aConsumer<InvocationError>
to receive async errors- Returns:
- a
Future<Object>
which returns the result of the remote invocation
-
getPayloadReader
-
setPayloadReader
-
getPayloadWriter
-
setPayloadWriter
-
getAsyncConnectionService
public AsyncConnectionService<org.zeromq.ZContext,org.zeromq.ZMQ.Socket> getAsyncConnectionService() -
setAsyncConnectionService
@Inject public void setAsyncConnectionService(AsyncConnectionService<org.zeromq.ZContext, org.zeromq.ZMQ.Socket> asyncConnectionService) -
getMinConnections
public int getMinConnections() -
setMinConnections
@Inject public void setMinConnections(@Named("dev.getelements.elements.rt.remote.RemoteInvoker.minConnections") int minConnections) -
getMaxConnections
public int getMaxConnections() -
setMaxConnections
@Inject public void setMaxConnections(@Named("dev.getelements.elements.rt.remote.RemoteInvoker.maxConnections") int maxConnections) -
toString
-