Transformer Pipeline Module API Reference
8.0.2.290852-a608fcd3
|
The pipeline module is a Transformer module which embeds a powerful, yet intuitive, scripting language. This permits rapid development and deployment of business rules.
Embedded scripting language
The pipeline module embeds version 5.1 of Lua, and the API defined in this document is written in Lua. Lua is a powerful light-weight language that is dynamically typed and has automatic memory management with garbage collection. For more information about Lua please see http://www.lua.org
Native function support
The pipeline module can integrate with existing transformer modules, calling their member functions directly, thus ensuring that the previous development can be reutilised.
Compilation free deployment
Pipeline scripts can be deployed without the need for a separate compilation step. Scripts are compiled into byte code as they are required.
The monitoring interface to the pipeline module allows updates to take place dynamically, a script can be uploaded whilst the Transformer is running and the current one will be replaced. Should the new script fail due to a syntax error, the change will be reverted until the next Transformer restart.
Opaque data storage
The pipeline module provides a mechanism to store and retrieve data between invocations. This permits data to be held between updates. Access to this storage is provided through the database package.
Data Dictionary Support
The pipeline module supports the concept of using a de-reference data dictionary, see Pipeline Concepts: Data Dictionary for more details.
The example below logs the trade price and time fields for all symbols under the /DEMO
namespace. It uses the log Library package which provides the log.log() function.
For clarity in this example we bypass the Data Dictionary functionality, calling methods on the dsdata objects directly.
Append this to the end of etc/pipeline.conf
:
add-pipeline id simple listener-regex ^/DEMO/ pipeline-file simple.lua update-func update end-pipeline
Place this in etc/pipeline/simple.lua
:.
require("log") function update(input) local output = createrecord(input:getsubject()) local price = input:getfield("TradePrice") local price_time = input:getfield("TradeTime") if price ~= nil then log.log(log.INFO, "TradePrice: "..price.."\n") log.log(log.INFO, "TradeTime: "..price_time.."\n") if output:numfields() > 0 then output:send() end end end