Class DefaultRoutingStrategy
java.lang.Object
dev.getelements.elements.rt.routing.DefaultRoutingStrategy
- All Implemented Interfaces:
RoutingStrategy
The default
RoutingStrategy which simply selects a RemoteInvoker from the
RemoteInvokerRegistry using RemoteInvokerRegistry.getBestRemoteInvoker(ApplicationId) and sends the
Invocation there.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninvokeAsync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Invokes the method returning aAsyncOperationfor the value.invokeFuture(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) invokeSync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Invokes the method, blocking until it returns on the remote end.voidsetApplicationId(ApplicationId applicationId) voidsetRemoteInvokerRegistry(RemoteInvokerRegistry remoteInvokerRegistry) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.rt.remote.RoutingStrategy
invokeAsyncV
-
Constructor Details
-
DefaultRoutingStrategy
public DefaultRoutingStrategy()
-
-
Method Details
-
invokeFuture
public Future<Object> invokeFuture(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RoutingStrategyInvokes the method returning aFuture<Object>with the result. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer).- Specified by:
invokeFuturein interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto receive the error of the invocation- Returns:
- the
Future<Object>to handle the return value
-
invokeAsync
public AsyncOperation invokeAsync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) Description copied from interface:RoutingStrategyInvokes the method returning aAsyncOperationfor the value.- Specified by:
invokeAsyncin interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto receive the error of the invocation- Returns:
- an instance of
AsyncOperation
-
invokeSync
public Object invokeSync(List<Object> address, Invocation invocation, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, InvocationErrorConsumer asyncInvocationErrorConsumer) throws Exception Description copied from interface:RoutingStrategyInvokes the method, blocking until it returns on the remote end. Corresponds toRemoteInvoker.invokeFuture(Invocation, List, InvocationErrorConsumer).- Specified by:
invokeSyncin interfaceRoutingStrategy- Parameters:
address- the addressinvocation- theInvocationasyncInvocationResultConsumerList- the list ofConsumer<InvocationResult>instancesasyncInvocationErrorConsumer- theInvocationErrorConsumerto receive the error of the invocation- Returns:
- the return value of the remote invocation
- Throws:
Exception
-
getRemoteInvokerRegistry
-
setRemoteInvokerRegistry
-
getApplicationId
-
setApplicationId
-