Advertisement
g1lmr

connection_target.json

Oct 5th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.66 KB | Source Code | 0 0
  1. {
  2.     "targetActorSelection": "/system/sharding/connection",
  3.     "headers": {
  4.         "aggregate": false
  5.     },
  6.     "piggybackCommand": {
  7.         "type": "connectivity.commands:createConnection",
  8.         "connection": {
  9.             "id": "mqtt-connection-target",
  10.             "connectionType": "mqtt",
  11.             "connectionStatus": "open",
  12.             "failoverEnabled": true,
  13.             "uri": "tcp://91.121.93.94:1883",
  14.             "targets": [{
  15.                 "address": "my.mqtt.test.notifications/{{ thing:id }}",
  16.                 "topics": [
  17.                     "_/_/things/twin/events",
  18.                     "_/_/things/live/messages"
  19.                 ],
  20.                 "authorizationContext": ["ditto:observer"],
  21.                 "qos": 0
  22.             }],
  23.             "mappingContext": {
  24.                 "mappingEngine": "JavaScript",
  25.                 "options": {
  26.                     "incomingScript": "function mapToDittoProtocolMsg(headers, textPayload, bytePayload, contentType) {return null;}",
  27.                     "outgoingScript": "function mapFromDittoProtocolMsg(namespace, id, group, channel, criterion, action, path, dittoHeaders, value, status, extra) {let textPayload = '{\"temperature\": ' + value.measurements.properties.temperature + ', \"humidity\": ' + value.measurements.properties.humidity + ', \"thingId\": \"' + namespace + ':' + id + '\"}'; let bytePayload = null; let contentType = 'text/plain; charset=UTF-8'; return  Ditto.buildExternalMsg(dittoHeaders, textPayload, bytePayload, contentType);}",
  28.                     "loadBytebufferJS": "false",
  29.                      "loadLongJS": "false"
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement