Appistry EAF provides Task APIs for .NET, 'C' (CentOS, RHEL, SUSE, and Windows), and Java.
Task API Overview
When a task is executed, it may be provided data in the context of the fabric request. The Task API allows you to manipulate the contents of a fabric request, as well as access fabric-specific information like the userid of the client executing the fabric request, etc.
| Values in the request |
The values in the context of a single fabric request are stored as name/value pairs. The data in the fabric request may come from client initiating the transaction, or from another task that participated in a process flow step in the same transaction. |
| result attribute |
This is a special value set by the task developer during task execution, and used to transition a process flow from one completed state to another. This task-result of the last task to execute is also returned to the client. The task-result is used by the fabric in concert with task-status which is a value set by the fabric indicating the success or failure of task execution. |
Task Types
The fabric is capable of running multiple, concurrent instances of a task on a worker or CPU. However, this is not always desirable. Appistry EAF allows you to configure a task by classifying it as one of four types and adding parameters based on the task type. The table below provides a basic overview of the four task types. For in depth explanations, refer to the appropriate task's tutorial.
| Task Type |
Characteristics |
Configuration |
Tutorial |
| Unlimited |
- No restrictions
- Multiple instances may run concurrently on multiple workers in the fabric
- Multiple requests for the task are serviced concurrently depending on available memory and CPU
|
Task XML file |
Hello World with Process Flows and tasks |
| Limited |
- Only a specified number of instances may run concurrently in the fabric (for example, a limited task may be configured to run on 2 out of 10 workers)
- A worker may run multiple instances of the task
- Multiple requests for the task are serviced concurrently depending on configuration, available memory, and CPU
|
Task XML file |
|
| Exclusive |
- Only a specified number of instances may run concurrently per worker or per CPU (for example, an exclusive task will run on every worker but be restricted to only one instance at a time based on worker or CPU)
- The fabric performs load control to balance requests for exclusive tasks across the fabric
- When multiple requests for an exclusive task arrive on a single worker, the requests are executed in a gated fashion. For example, if exclusive tasks are configured to allow two concurrent per worker, then two requests are serviced at a time while other requests wait their turn.
- Good for long running tasks (several seconds or more) or CPU intensive
|
Task XML file and fabric.cfg |
Computing Pi using Exclusive Tasks tutorial |
| Background |
- Runs constantly waiting for work (like a unix daemon or Windows service)
- Background tasks are not called from a process flow as part of a client request, but rather get "work" as defined by the task implementer. For example, the background task might monitor a queue in fabric accessible memory (FAM), read from a socket. or poll a service external to the fabric.
- Since it is not part of a fabric request, background tasks do not have the same inherent reliability as the other task types
|
Task XML file |
|
Appistry EAF provides Task APIs for .NET, 'C' (CentOS, RHEL, SUSE, and Windows), and Java.