Key Fields for Distribution (Affinity)

When you define key fields for a tuple, ActiveSpaces allows you to define the key fields in a way that controls their distribution over seeders. This feature of ActiveSpaces is called “affinity.”

By specifying that certain key fields are distribution fields, your application can ensure that tuples that have the same value for a particular field or fields, are stored on the same seeder.

The ActiveSpaces API provides functions and methods for each API set to enable distribution based on affinity:

  • Java  setDistributionFields()
  • C  tibasSpaceDef_SetDistributionFields()
  • .NET  SetDistributionFields

Each function or method takes as its arguments the space definition for the space that is to be defined and a list of fields within quotation marks, separated by commas.

For more information on the C API function, see the reference article for the tibasspaceDef_SetDistributionFields() function in the TIBCO ActiveSpaces C API Reference.

For more information on the Java method, see the JavaDoc entry for setDistributionFields().

Each API set also provides a function to retrieve the distribution key setting for a specified space. For example, the Java API provides the getDistributionFields() method.

Admin CLI Support for Distribution Fields

When you define a space using the define | create space command in the ActiveSpaces Admin CLI, you can specify the distribution_def parameter to set specified keys for distribution fields. And when you issue the show spaces command, the command output indicates any fields that are set up as distribution fields.

For more information, see the reference article for define | create space in the TIBCO ActiveSpaces Administration guide.

SpaceWait
No operations on a space are possible unless the space is in the READY state. To help synchronize applications with the space state, each space has a SpaceWait attribute. This attribute is the number of milliseconds a space operation will block for and wait for the space to reach the READY state if it is not in that state at the time the operation is invoked.