-
Notifications
You must be signed in to change notification settings - Fork 35
Trooper Task Framework
The Trooper Task Framework defines a contract and implementation for breaking up functionality to be executed as a set of smaller units of work or tasks.
The Trooper service examples demonstrate use of the Task framework to implement services. See GreetingService (Service implemented using Tasks) for sample use.
The Trooper Validation Framework is implemented using a subset of the Task Framework classes. See org.trpr.platform.spi.validation
package classes in the platform-task project.
GroupID/Org | ArtifactID/Name | Description |
---|---|---|
org.trpr | platform-task | The Task framework project. Contains API and a few default implementations |
The primary interface of interest in this framework is org.trpr.platform.spi.task.Task
. Javadoc for this interface states this:
The Task defines a unit of work that may be executed in a suitable environment/container. A Task is an implementation of the Command Pattern where org.trpr.platform.spi.task.TaskData
contains all information required to execute the Task.
Tasks may access resources during execution. Javadoc for the Resource interface states this : The Resource interface is a resource descriptor that abstracts from the actual type of underlying resource, such as a file, classpath resource, a POJO instance or database connection. This interface defines methods to define proxies and serialized form, suitable for distribution and remote execution.
Defines an interface for executing tasks. Task managers execute the given tasks locally or leverage frameworks that support different topologies for execution like compute-grids : distributed, asynchronous, parallel execution.
Defines an interface for Tasks to communicate with the execution environment/container. The context provides methods to publish events and query for results from prior task executions.
Javadoc for this class says this: The TaskData defines an implementation for passing data used in execution of a Task. In its most basic form, the TaskData provides for one or more BusinessEntity and a set of Resource instances
The TaskResult holds results from execution of an individual Task. It in turn contains an ExecutionSummary that is a composite data structure of execution result code, severity and relevant message. It also holds the business entities used in task execution.
The following examples in Trooper use the Task Framework :
- Service implemented using Tasks : GreetingService
- Task using Validation Framework : GreetingTask
- Task using Resource : ComplexEventProcessing Task