What
...
Is a Pipeline
A pipeline is an ordered collection of tasks executed in sequence. This can be used to chain together tasks that are executed in order, e.g. call a service, transform its output from XML to JSON and return the response.
For more information on configuring pipelines for the Gateway see these pages Config - Pipelines.
What
...
Is a Task
A task is an action performed within a pipeline - many different tasks existsexist, ranging from branches (if...then...else) task, to validations, convertionsconversions, logging, tracing to service callouts, proxying requests or returning responses.
...
Example flow of tasks within a pipeline.
Drawio | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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.
...
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.
List of
...
Tasks
The following tasks are currently available:
...
- If...then...else
Allows you to branch out, based upon a list of configured conditions - if conditions match, one branch of tasks are executed, if not - another branch is executed instead. - If failure then... else
If any of the previous tasks has have failed with an error (unless the error has been cleared) then execute X tasks, if not, execute Y other tasks.
...
- Base64 encode/decode
Base64 encode or decode any value - result is stored in a request attribute. - URL encode/decode
Allows you to URL encode/decode any value, variable or macro - result is stored in a request attribute. - HTML encode
Allows you to HTML encode a text - escapes any HTML characters ensuring the result is safe to display in a web page. - Transform JSON to XML
Transforms JSON into XML tags. - Transform XML to JSON
Transforms XML into JSON, note that some information will be lost in transit, such as attributes, order and namespaces. - Transform JSONML to XML
Transforms from JSON Markup Language into XML - see http://www.jsonml.org/ for information on JSON ML. - Transform XML to JSONML
Transform from XML into JSON Markup Language - this transformation can be reverted back into JSON without loss of data, but note that the format is quite verbose and may take up a lot of memory space.
...
- Write to Trace
If request trace is enabled within the gateway, this writes a value to it. - Write to Log
Writes a value to the log at the given log level - logger name can also be specified. - Write to Transaction Log
Allows you to write a message to the transaction log - this log resides at the Ceptor Session Controller - implemented by individual authentication plugins so writing here is a remote call.
...