Skip Headers
Oracle® Coherence Client Guide
Release 3.7.1

Part Number E22839-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

21 Performing Remote Invocations (.NET)

Coherence for .NET provides a Remote Invocation Service which allows execution of single-pass agents (called 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.

The following section is included in this chapter:

21.1 Configuring and Using the Remote Invocation Service

A Remote Invocation Service is configured using the <remote-invocation-scheme> element in the cache configuration descriptor. For example:

Example 21-1 Configuring a Remote Invocation Service

...
<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>9099</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:

Example 21-2 Obtaining a Reference to a Remote Invocation Service

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:

Example 21-3 Executing an Agent on a Grid Node

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 Chapter 17, "Configuration and Usage for .NET Clients" for additional details.