Transformer Pipeline Module API Reference (JavaScript)
8.0.2.290852-a608fcd3
|
The functions in this package provide access to the contents of the Transformer's cache.
This package also contains functionality for managing the subscription of objects requested from and by other DataSource peers.
Functions | |
cache.sendNodata (var symbol, var flags) | |
Send a nodata message to the Transformer. More... | |
cache.getField (var symbol, var field) | |
Get a field from the cache. More... | |
cache.getUpdate (var symbol) | |
Obtain the cached image for a symbol. More... | |
cache.request (var symbol, var accessory) | |
Request updates for a symbol to flow into the Transformer. More... | |
cache.discard (var symbol, var accessory) | |
Stop updates for a symbol flowing into the Transformer. More... | |
cache.match (var pattern) | |
Return a array of symbols matching a pattern. More... | |
cache.getStatus (var symbol) | |
Return the status of a symbol. More... | |
cache.sendStatus (var symbol, var status, var message) | |
Send a status message. More... | |
cache.getSubjectType (var symbol) | |
Obtain the type for a symbol in the cache. More... | |
cache.removeCurrentPipelineSubscription () | |
Cancel the current subscription on this pipeline. More... | |
cache.subscribePipelines (var symbol) | |
Subscribe to a symbol on all pipelines. More... | |
cache.blockUpdates () | |
Block updates for the current symbol on this pipeline. More... | |
cache.unblockUpdates (var symbol) | |
Unblock future updates for the given symbol on all pipelines. More... | |
cache.blockUpdates | ( | ) |
Block updates for the current symbol on this pipeline.
This function blocks the updates for the symbol currently being handled by the pipeline from entering the pipeline. Updates still enter the Transformer but they are blocked from entering the current pipeline. No other pipelines matching the symbol are affected. Note that only updates are affected: status, nodata, request and discard messages are not blocked.
Example:
The following example shows an update function blocking updates for the received symbol based on a given field. If the "Block" field is 1 then updates are blocked and will not reach the update function until they are unblocked - see cache.unblockUpdates().
Note that there is no else case to unblock the update because once cache.blockUpdates() has been called, update() will not be entered for the symbol. Hence unblocking will normally be called from another pipeline.
function update(dsdata) { var block = dsdata.getField("Block"); if ( parseInt(block) == 1 ) { cache.blockUpdates(); } }
cache.discard | ( | var | symbol, |
var | accessory | ||
) |
Stop updates for a symbol flowing into the Transformer.
symbol | - Symbol to discard |
accessory | - [Optional] If defined, then this subscription is an accessory |
cache.getField | ( | var | symbol, |
var | field | ||
) |
Get a field from the cache.
symbol | - Symbol whose field should be retrieved |
field | - Field to return |
nil | - Field not cached or symbol not known |
The field may either be a number (eg 22), or a full name as defined in fields.conf (eg BID)
cache.getStatus | ( | var | symbol | ) |
Return the status of a symbol.
symbol | - Symbol to query the status of |
cache.STATUS_OK | - Symbol status is ok |
cache.STATUS_LIMITED | - Symbol status is limited |
cache.STATUS_STALE | - Symbol status is stale |
cache.STATUS_UNKNOWN | - No status available for symbol |
A second return parameter contains the status message as a string
cache.getSubjectType | ( | var | symbol | ) |
Obtain the type for a symbol in the cache.
symbol | - Symbol whose type should be retrieved |
-1 | - Symbol not cached |
cache.getUpdate | ( | var | symbol | ) |
Obtain the cached image for a symbol.
symbol | - Symbol whose cached update should be retrieved |
nil | - Symbol not cached or symbol is in cache but has no fields |
cache.match | ( | var | pattern | ) |
Return a array of symbols matching a pattern.
pattern | - [Optional] a pattern to match |
If no pattern is supplied, then the pattern is implicitly "/*"
The example below returns a list of all symbols in the cache and prints their names to stdout.
syms = cache.match(); for ( i = 0; i < syms.length; i++) { print("[" + i + "] " + syms[i]); }
cache.removeCurrentPipelineSubscription | ( | ) |
Cancel the current subscription on this pipeline.
This function cancels the subscription for the symbol currently being handled by the pipeline. The subscription is only cancelled for the current pipeline.
cache.request | ( | var | symbol, |
var | accessory | ||
) |
Request updates for a symbol to flow into the Transformer.
symbol | - Symbol to request |
accessory | - [Optional] If defined, then this subscription is an accessory |
A pipeline should be configured as a listener for this symbol
cache.sendNodata | ( | var | symbol, |
var | flags | ||
) |
Send a nodata message to the Transformer.
symbol | - Symbol that a nodata message should be sent for |
flags | - [Optional] optional flags |
The default flag sent is dsdata_F_DELETEOBJECT.
The nodata will propagated onto any connected peers if they are receving updates for symbol.
cache.sendStatus | ( | var | symbol, |
var | status, | ||
var | message | ||
) |
Send a status message.
symbol | - Symbol to send the status of |
status | - Status code to send |
message | - Status message to send |
The status should be one of the following values:
The status will be distributed to all interested peers and modules
Example:
The following example sends a STALE message for subject /FX/EURGBP=
cache.sendStatus("/FX/EURGBP=", cache.STATUS_STALE, "Object is stale")
cache.subscribePipelines | ( | var | symbol | ) |
Subscribe to a symbol on all pipelines.
symbol | - Symbol to subscribe to |
This function reinstates the subscription for the given symbol on all pipelines which match the symbol.
Example:
The following example reinstates the subscriptions for subject /FX/EURGBP
cache.subscribePipelines("/FX/EURGBP")
cache.unblockUpdates | ( | var | symbol | ) |
Unblock future updates for the given symbol on all pipelines.
symbol | - Symbol whose updates are being unblocked. |
This function unblocks the updates for the given symbol on all pipelines which match the symbol, i.e. calling this function allows updates for the given symbol to be passed into all matching pipelines.
Example:
The following example unblocks the updates for subject /FX/EURGBP
cache.unblockUpdates("/FX/EURGBP")