21 Performing Remote Invocations (.NET)
This chapter includes the following sections:
- Overview of Performing Remote Invocations
Coherence for .NET provides a Remote Invocation Service which allows execution of single-pass agents (calledIInvocable
objects) within the cluster-side JVM to which the client is connected. - Configuring and Using the Remote Invocation Service
A Remote Invocation Service is configured using the<remote-invocation-scheme>
element in the cache configuration descriptor.
Parent topic: Creating .NET Extend Clients
Overview of Performing Remote Invocations
IInvocable
objects) within the cluster-side JVM to which the client is connected. Agents are simply runnable application classes that implement the IInvocable
interface. Agents can execute any arbitrary action and can use any cluster-side services (cache services, grid services, and so on) necessary to perform their work. The agent operations can also be stateful, which means that their state is serialized and transmitted to the grid nodes on which the agent is run.
Parent topic: Performing Remote Invocations (.NET)
Configuring and Using the Remote Invocation Service
<remote-invocation-scheme>
element in the cache configuration descriptor.For example:
... <remote-invocation-scheme> <scheme-name>example-invocation</scheme-name> <service-name>ExtendTcpInvocationService</service-name> <initiator-config> <tcp-initiator> <remote-addresses> <socket-address> <address>localhost</address> <port>7077</port> </socket-address> </remote-addresses> </tcp-initiator> <outgoing-message-handler> <request-timeout>30s</request-timeout> </outgoing-message-handler> </initiator-config> </remote-invocation-scheme> ...
A reference to a configured Remote Invocation Service can then be obtained by name by using the CacheFactory
class:
IInvocationService service = (IInvocationService) CacheFactory.GetService("ExtendTcpInvocationService");
To execute an agent on the grid node to which the client is connected requires only one line of code:
IDictionary result = service.Query(new MyTask(), null);
The single result of the execution are keyed by the local Member
, which can be retrieved by calling CacheFactory.ConfigurableCacheFactory.LocalMember
.
Note:
Like cached value objects, all IInvocable
implementation classes must be correctly registered in the POF context of the .NET application and cluster-side node to which the client is connected. As such, a Java implementation of the IInvocable
task (a com.tangosol.net.Invocable
implementation) must be created, compiled, and deployed on the cluster-side node. Note that the actual execution of the task is performed by the Java Invocable
implementation and not the .NET IInvocable
implementation. See Introduction to Coherence .NET Clients.
Parent topic: Performing Remote Invocations (.NET)