Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher Base64 payload is not routable in IoT Hub #126

Closed
toddysm opened this issue Oct 3, 2019 · 2 comments
Closed

Publisher Base64 payload is not routable in IoT Hub #126

toddysm opened this issue Oct 3, 2019 · 2 comments
Assignees
Labels
feature request New feature or request

Comments

@toddysm
Copy link

toddysm commented Oct 3, 2019

Describe the bug
We are using the OPC Publisher to collect information from devices and would like to route the information to different IoT Hub endpoints based on the payload we receive from the device. However, we noticed that the payload is Base64 encoded and the IoT Routing queries are not applied on properties in the body as described in the following article.

https://azure.microsoft.com/en-us/blog/iot-hub-message-routing-now-with-routing-on-message-body/

To Reproduce
Here is the message received from the OPC Publisher:

{
  "EnqueuedTimeUtc": "2019-10-03T17:58:46.6340000Z",
  "Properties": {},
  "SystemProperties": {
    "connectionDeviceId": "agitaretech-iot-test-gw",
    "connectionModuleId": "opc-publisher",
    "connectionAuthMethod": "{\"scope\":\"module\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
    "connectionDeviceGenerationId": "637048513528304448",
    "contentType": "application/opcua+uajson",
    "contentEncoding": "UTF-8",
    "enqueuedTime": "2019-10-03T17:58:46.6340000Z"
  },
  "Body": "eyJOb2RlSWQiOiJucz0yO3M9VjAuNjMiLCJBcHBsaWNhdGlvblVyaSI6InVybjpldGgwOlJpdHRhbDpDTUNfSUlJX1VBX1NlcnZlciIsIkRpc3BsYXlOYW1lIjoibnM9MjtzPVYwLjYzIiwiVmFsdWUiOnsiVmFsdWUiOjIzLjcsIlNvdXJjZVRpbWVzdGFtcCI6IjIwMTktMTAtMDNUMTc6NTg6NDQuMDU1MDAwMCswMDowMCJ9fQ=="
}

The decoded body is:

{
  "NodeId": "ns=2;s=V0.63",
  "ApplicationUri": "urn:eth0:Rittal:CMC_III_UA_Server",
  "DisplayName": "ns=2;s=V0.63",
  "Value": {
    "Value": 23.7,
    "SourceTimestamp": "2019-10-03T17:58:44.0550000+00:00"
  }
}

The following messge routing query does not work in IoT Hub:

$body.NodeId = 'ns=2;s=V0.63'

Messages are not routed based on the condition above.

Expected behavior
Ability to route based on the $body properties.

@marcschier
Copy link
Collaborator

This is related to the content type being set != application/json. A quick fix could be to set it to application/json, but this a) could break other applications and b) will be broken in our next publisher release.

Since in future version of publisher as per customer ask we will be sending OPC UA binary (or OPC UA Json) and "Pub/Sub compliant" network messages from publisher, and both are not routable, we will anyway need an extra conversion module at edge side to convert to some simplistic, routable message format for this scenario.

As such I am tracking this item as feature request to add such sample module, instead of closing.

@marcschier
Copy link
Collaborator

We decided to close and track feature work separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants