...
Tasks can be anything from doing base64 or html encoding/decoding of a block of text to a call to a service to retrieve data, or run custom scripts to e.g. merge the output of multiple separate service calls with each other. There are also tasks for performing validation of input requests or output data, writing data to the log or transformations of data format between XML and JSON.
Example
Example flow of tasks within a pipeline.
In this example, we have a pipeline with a number of tasks, first we call a service, then update the value of a request attribute with the content of the HTTP response headers, after this, we transfer from JSON to XML, and then in case of failure we send a failure response, otherwise we update the JSON content by running a script (here, we add the XML as an attribute in the response) which we then send in the final task.
This is just one example - any number of tasks can be executed within the pipeline, and other pipelines can be called from within one to allow reuse of often-used sequence of tasks.
Here is a screenshot of how these tasks are edited in theĀ Ceptor Console. You can reorder tasks by dragging them around in the list, and right-click them to add/remove more. You can also drag new tasks into the pipeline from the Task Palette.
Are tasks always needed ?
No, tasks are not always needed - you might be able to perform similar custom actions in an authentication or authorization script within the gateway, but tasks are often a more elegant and more readable way of archiving results.
Also, while a script needs to block waiting for external events to complete, a task can be asynchronous, so some operations especially those that do IO work will perform better when split into async tasks.
...