FIWARE Orion:通知响应

FIWARE Orion: notification responses

在 Orion 中我可以创建订阅:

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

在此示例中,Orion 将在服务器 http://localhost:1028/accumulate 上执行 POST 请求。有没有办法从 Orion 收到的 POST 中检索响应?即 200、404... 在我的用例中,通知执行 POST 请求以在另一台服务器上创建一些资源。 POSTs returns 创建资源的位置。检索这些位置会很有用。

Orion 不会记录对其发送的通知的响应。它实现了 "fire and forget" 方法并且很少关注通知请求的响应。实际上,Orion 查看最后一个通知的响应并使用它来设置 lastFailurelastSuccess 时间戳(视情况而定),如果响应有,则将 status 设置为 failed错误代码。

可以使用中间系统来解决您的案例。我的意思是,一些桥接软件从 Orion 接收通知,转发到最终系统,获取响应并执行任何应该对此类响应进行的处理(例如存储刚刚创建的资源的位置)。