This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stateDiagram-v2 | |
[*] --> Triggered: PRODUCT_DATA_MERGE_TRIGGERED | |
Triggered --> Saved: New task | |
Triggered --> Discarded: Unprocessed task exists | |
Triggered --> SavedButNotQueued: Processing task exists | |
Discarded --> End | |
Saved --> Queued | |
Queued --> Started: PRODUCT_DATA_MERGING | |
Started --> Succeeded: PRODUCT_DATA_MERGED | |
Started --> Failed: PRODUCT_DATA_MERGE_FAILED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: mqtt-provider | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: mqtt-service-provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": "_design/subscriptions", | |
"views": { | |
"host_topic_counts": { | |
"reduce": "_sum", | |
"map": "function (doc) {\n emit(doc.url + '#' + doc.topic, 1);\n}" | |
}, | |
"host_topic_triggers": { | |
"map": "function (doc) {\n emit(doc.url + '#' + doc.topic, {trigger: doc._id, username: doc.username, password: doc.password});\n}" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function action(args) { | |
var request = require('sync-request'); | |
var res = request('POST', 'http://COUCHDB_HOST:COUCHDB_PORT_NUMBER/readings/', { | |
json: {reading: args}, | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function action(args) { | |
var request = require('sync-request'); | |
var res = request( | |
'GET', | |
'http://COUCHDB_HOST:COUCHDB_PORT/readings/_all_docs?limit=10&include_docs=true&ascending=true' | |
); | |
var readings = JSON.parse(res.getBody().toString()).rows.map(elem => elem.doc.reading); | |
return { | |
body: readings | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main({reading}) { | |
var script = ` | |
<script> | |
function latest_readings() { | |
const Http = new XMLHttpRequest(); | |
//URL to getLatestTenReadings web action | |
const url='https://OPENWHISK_HOST:OPENWHISK_PORT/api/v1/web/guest/default/getLatestTenReadings'; | |
Http.open("GET", url); |