A Task that represent a set of other tasks.
The purpose of this class is to get around two limitations in App Engine:
- Only a small number (currently 5) of task queue tasks is permitted to be part of of a data store transaction.
- Named task queue tasks may not be part of a data store transaction.
This task is used as part of a strategy to get around those limitations: Instead of enqueueing a set of tasks, a single {@code FanoutTask} may beenqueued that, when handled, will cause a collection of other tasks to be enqueued.
Given a Collection of Tasks, the static method {@link #encodeTasks(Collection)} may be used to encode the Collection into abyte array which may be persisted to the data store. An instance of this class may contain the data store key of the entity containing the byte array. This single task may be enqueued as part of a data store transaction. Later, when the task is handled, the data store key may be retrieved from an instance of this class and the byte array retrieved from the data store. Then the static method {@link #decodeTasks(byte[])} may be used to reconstitutethe original Collection of Tasks. Finally each of the tasks in the collection may be enqueued non-transactionally.
@see com.google.appengine.tools.pipeline.impl.backend.PipelineBackEnd#handleFanoutTask
@author rudominer@google.com (Mitch Rudominer)