@ComponentSpecification public interface RemoteInvocationCommandCaller extends AbstractRemoteInvocationCommandCaller, RemoteInvocationCaller<RemoteInvocationCommandQueue>
RemoteInvocationCommands from the client-side. The most simple usage
is given in the following example:
However, there are advanced features such as queuing command calls and send them in a single technical request. Therefore you should useRemoteInvocationCommandCallercaller = getCommandCaller(); MyCommand command = new MyCommand(payload); caller.callCommand(command, this::onSuccess, this::onFailure);
RemoteInvocationCommandQueue as illustrated by this example:
This might look a little complex on the first view, but it allows very powerful but quite easy usage of asynchronous service invocations. In the example above a specific command is created that represents a particular service invocation. This command is recorded by theRemoteInvocationCommandCallercaller = getCommandCaller();RemoteInvocationCommandQueuequeue = caller.RemoteInvocationCaller.newQueue(); MyCommand command = new MyCommand(payload); queue.setDefaultFailureCallback(this::onFailure); queue.callCommand(command, this::onSuccess); ... queue.commit();
RemoteInvocationCommandQueue. It
will be send to the server when the top-level queue is committed. When the result is received from the server, it will be
passed to the provided success callback
function. net.sf.mmm.util.lang.api.function for details. If you are using a java version less than 1.8, you
can NOT use lambdas and have to provide instances via anonymous classes.callCommand, callCommandgetCurrentQueue, newQueue, newQueue, newQueueCopyright © 2001–2016 mmm-Team. All rights reserved.