Context Tuples

ActiveSpaces supports a special tuple called a context tuple. A context tuple is used to dynamically pass user-defined information between your ActiveSpaces processes. A context tuple does not need to have any particular set of fields. You are free to decide the information you want to pass back and forth between your processes.

Context tuples are not stored in a space. Instead context tuples can be created and set when:

  • Defining a metaspace member (set in the MemberDef object)
  • Defining a space (set in the SpaceDef object)
  • Registering a listener (C API)
  • Making remote invocation calls

You can retrieve the context tuple by invoking the corresponding GetContext method for the following objects:

  • Member, MemberDef, SpaceDef
  • From Java and .NET listener methods which receive a Member, MemberDef, or SpaceDef object
  • From the closure object passed to listener methods in the C API

When using remote invocation, the originator of the remote invocation passes information to the handler of the remote invocation using the context tuple. The handler of the remote invocation passes information back to the originator of the remote invocation in the result tuple. Similar to the context tuple, the result tuple for remote invocations is user-defined. The ASPerf example makes extensive use context tuples and result tuples in remote invocations to pass information between the ASPerf master (originator of the remote invocation) and the ASPerf slaves (remote invocation handlers).

Related reference