Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 5 Using the Example Code : Remote Space Invocation: InvokeClient

Remote Space Invocation: InvokeClient
The example directory for each API set also contains an example showing how to implement and use remote space invocation.
Overview
The InvokeClient example demonstrates how to invoke a user defined method on:
Implementations of the Invocable and MemberInvocable interfaces are provided.
Starting InvokeClient
The following examples show how to invoke InvokeClient for each API set.
Java Invocation
java InvokeClient -metaspace examplems -member_name invoke
C Invocation
InvokeClient -metaspace examplems -member_name invoke
.NET Invocation
AS_HOME/examples/dotnet/InvokeClient.exe -metaspace examplems -member_name invoke
Starting InvokeClient with Security
The following example shows the command line options that you can use when starting InvokeClient to have it join the security domain exdomain and to use a space with an additional encrypted field:
-discovery tcp://127.0.0.1:50000 -member_name invoke -security_token exdomain_token.txt -encrypt_field
These command line options start InvokeClient using the default metaspace named ms and allow it to connect to a security domain controller that has been started using the example security policy file example_policy.txt. Using the -encrypt_field command line option allows InvokeClient to connect to the same space defined when ASOperations is started with security and the -encrypt_field command line option.
Using InvokeClient
After InvokeClient initializes, the following options are displayed that allow you to perform actions on the space:
key invokes the user defined method on the space member that holds the tuple with a key of 1.
self invokes the user-defined method on the invoking member in the space (e.g. InvokeClient).
seeders invokes the user-defined method on all seeders in the space.
members invokes the user defined method on all members in the space.
The Invocable interface is used when the key option is selected. The MemberInvocable interface is used when the self, seeders, or members option is selected.
The purpose of the key option is to see that the user-defined method is invoked on the seeder that contains the entry with the key of 1. To see anything with the key option, you should start up two instances of ASOperations, using the -role seeder command line option, and put some entries into the space, making sure that you have an entry with a key of 1.
When the example is run and the key option is selected, you will see the-user defined method of the Invocable interface run by the seeder that contains the entry with a key of 1.
The purpose of the other options is to let you see how the user-defined implementation of MemberInvocable is called on different members of the space. The InvokeClient example joins the space as a leech. To see what happens when the user-defined method is invoked with these different options, start up two instances of ASOperations, using the -role seeder command line option, along with InvokeClient. In this case:
The self option should cause the user-defined method to be invoked on InvokeClient.
The seeders option should cause the user-defined method to be invoked on the other ASOperations instances.
The members option should cause the user-defined method to be invoked on InvokeClient and the other ASOperations instances.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved