Program guide > Access data with client applications > Programming for transactions > Run parallel logic with the DataGrid API



DataGrid agents and entity-based Maps

A map contains key objects and value objects. The key object is a generated tuple as is the value. An agent is normally provided with the application specified key objects.

The key object is a generated tuple as is the value. An agent is normally provided with the application specified key objects. This will be the key objects used by the application or Tuples if it is an entity Map. An application using Entities will not want to deal with Tuples directly and would prefer to work with the Java™ objects mapped to the Entity.

Therefore, an Agent class can implement the EntityAgentMixin interface. This forces the class to implement one more method, getClassForEntity(). This returns the entity class to use with the agent on the server side. The keys are converted to this Entity before invoking the process and reduce methods.

This is a different semantic to an non EntityAgentMixin agent where those methods are provided with just the keys. An agent implementing EntityAgentMixin receives the Entity object which includes keys and values in one object.

If the entity does not exist on the server, the keys are the raw Tuple format of the key instead of the managed entity.


Parent topic:

Run parallel business logic on the data grid (DataGrid API)