如何使用 Orion 在外发通知中添加自定义 header?
How to add a custom header in outgoing notifications with Orion?
我阅读了 NGSIv2 specification 中的 "Custom notifications" 部分,但我仍然对如何使这项工作产生疑问。
我是否必须将以下代码作为有效负载放入我的订阅 POST?
"httpCustom": {
"url": "http://foo.com/entity/${id}",
"headers": {
"Content-Type": "text/plain"
},
"method": "PUT",
"qs": {
"type": "${type}"
},
"payload": "The temperature is ${temperature} degrees"
}
对于 Authentication/Authorization 的订阅,带有 httpCustom 的完整负载如何?
最后,真的有必要用Rush, as stated at Rush Relayer吗?在这种情况下,我们必须使用大约 3 年前更新的 "third-party" 软件。为什么 Orion 不提供这个?对此我也很感激。
可以使用以下httpCustom
:
"httpCustom": {
"url": "http://example.com/some/path",
"headers": {
"X-Auth-Token": "n5u43SunZCGX0AbnD9e8R537eDslLM"
}
}
令牌 will expire from time to time. Thus, it should be renewed at a regular interval, modifying the httpCustom
element with the new token (using PATCH /v2/subscriptions/<id>
operation, see NGSIv2 specification 了解详情)。
关于Rush,如果能用一些同等的软件达到HTTP-to-HTTPS就没有必要了。 Orion 的本机 HTTPS 通知已被标识为 a topic of interest and even there was a pull request,并在该行中实现了代码。目前这不是优先事项,但是欢迎与此相关的贡献:)
编辑: 上述 httpCustom
配置将使 Orion 发送通知,包括 X-Auth-Token
header。因此,假设在 url
端点(例如上例中的 http://example.com/some/path
)能够处理 X-Auth-Token
header 的身份验证元素将被监听(通常是策略执行点 -PEP- 代理)。
更新: 自版本 1.7.0 以来,Orion 实现了本机 HTTPS 通知(即不需要 Rush)。
我阅读了 NGSIv2 specification 中的 "Custom notifications" 部分,但我仍然对如何使这项工作产生疑问。
我是否必须将以下代码作为有效负载放入我的订阅 POST?
"httpCustom": {
"url": "http://foo.com/entity/${id}",
"headers": {
"Content-Type": "text/plain"
},
"method": "PUT",
"qs": {
"type": "${type}"
},
"payload": "The temperature is ${temperature} degrees"
}
对于 Authentication/Authorization 的订阅,带有 httpCustom 的完整负载如何?
最后,真的有必要用Rush, as stated at Rush Relayer吗?在这种情况下,我们必须使用大约 3 年前更新的 "third-party" 软件。为什么 Orion 不提供这个?对此我也很感激。
可以使用以下httpCustom
:
"httpCustom": {
"url": "http://example.com/some/path",
"headers": {
"X-Auth-Token": "n5u43SunZCGX0AbnD9e8R537eDslLM"
}
}
令牌 will expire from time to time. Thus, it should be renewed at a regular interval, modifying the httpCustom
element with the new token (using PATCH /v2/subscriptions/<id>
operation, see NGSIv2 specification 了解详情)。
关于Rush,如果能用一些同等的软件达到HTTP-to-HTTPS就没有必要了。 Orion 的本机 HTTPS 通知已被标识为 a topic of interest and even there was a pull request,并在该行中实现了代码。目前这不是优先事项,但是欢迎与此相关的贡献:)
编辑: 上述 httpCustom
配置将使 Orion 发送通知,包括 X-Auth-Token
header。因此,假设在 url
端点(例如上例中的 http://example.com/some/path
)能够处理 X-Auth-Token
header 的身份验证元素将被监听(通常是策略执行点 -PEP- 代理)。
更新: 自版本 1.7.0 以来,Orion 实现了本机 HTTPS 通知(即不需要 Rush)。