1
votes

In Orion I can create subscription:

curl localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' \
    -d @- <<EOF
{
  "description": "A subscription to get info about Room1",
  "subject": {
    "entities": [
      {
        "id": "Room1",
        "type": "Room"
      }
    ],
    "condition": {
      "attrs": [
        "pressure"
      ]
    }
  },
  "notification": {
    "http": {
      "url": "http://localhost:1028/accumulate"
    },
    "attrs": [
      "temperature"
    ]
  },
  "expires": "2040-01-01T14:00:00.00Z",
  "throttling": 5
}
EOF

In this example, Orion will perform POST request on the server http://localhost:1028/accumulate. Is there a way to retrieve the response from the POST received by Orion? i.e. 200, 404... In my use case the notifications perform POST requests to create some resources on another server. The POSTs returns the location of the created resources. It would be useful to retrieve those locations.

1
"In Orion I can create notifications". Do you actually mean "create subscription"? - fgalan
yes, corrected. - cdupont

1 Answers

1
votes

Orion doesn't record the responses to notifications it sends. It implements a "fire and forget" approach and pays little attention to the response of notification requests. Actually, Orion looks to the response of the last notification and uses it to set lastFailure or lastSuccess timestamp (depending the case) and setting status to failed if the response has an error code.

A workaround for your case could be achieved using a system in the middle. I mean, some bridging software that receives the notification from Orion, forwards to the final system, gets the response and does whatever processing should be do with such response (e.g. storing the location of the just created resource).