by Steven Yu
Version 3 (March 16, 2018)
Download (249 downloads)
MESSAGE RETRY:
==========
The flow will handle connection failure retries for all REST methods using a give-take pair, allowing for up to 128 messages to be queued up for retry. Retry logic currently retries a single message every minute, until the queue empties. The retry fiber is internal, and starts automatically only when a failure occurs. The fiber will shut down 1 minute after the queue is empty.
DATA CACHING:
==========
Store get responses within a dictionary to improve data and battery consumption, processing time and fail-over capabilities of flows with REST calls. Multiple caches can be stored, each via a key, and each supporting an independent TTL value
Refresh will only happen on the request after ttlCache seconds have passed. There are active schedulers to maintain freshness.
Last available cached value will be used on refresh failures. If no cache exists, the flow returns with error code 404.
Dictionary key is stored from connectorInput. If a getCache call cannot find the key, the flow will respond back with error code 400.
LOG:
==========
The connector generate messages on HTTP response. The fiber also generates customizable short toast messages on HTTP success.
The cache generate messages at the beginning and end of cache rebuilds.
"printRetryQueue" print out all messages pending retry.
"pringCache" print out all cache KV pairs.
MAINTENANCE:
==========
"connectorReset" reset connector variables, purged retry queue and stop retry flow.
"cacheCleanup" reset the cache dictionary, and stop controller flow
"cacheBuild" force load new cache values for each dictionary key in the input
connectorInput INPUT:
==========
{
"action": String, (support GET, POST, PUT, DELETE)
"uri": String,
"payload": JSON,
"account": String, (optional, name of the account authorization details stored on automate)
"iterations": Number, (optional, attempt number to deliver the message)
"timestamp": Number, (optional, timestamp of when the message was first generated to be used in logs)
"toast": String, (optional)
"callbackUri": String, (optional, flow URI to contact on HTTP success)
"callbackPayload": undefined (optional, pass-through to callbackUri)
}
connectorInput CALLBACK:
==========
{
"responseCode": number,
"responsePayload": JSON,
"callbackPayload": undefined
}
cacheBuild INPUT:
==========
{
"key1": { (String, key to address this particular cache)
"input": {
"action": String,
"targetUri": String, (target URI for GET)
"account": String, (optional)
"ttlCache": Number (number of seconds the cache is fresh for, -1 disables refresh)
}
}
}
cacheGet INPUT:
==========
{
"getList": [String], (array of stored keys)
"callbackUri": String,
"callbackPayload": undefined (optional)
}
cacheGet CALLBACK:
==========
{
"getList": {
"key1": {JSON}, (cached response body, support multiple responses)
},
"callbackPayload": undefined (optional)
}