Custom JSON formatting that supports Azure IoT Hub Endpoint routing


#1

I am attempting to use a Particle Azure IoT Hub integration to send the following Custom JSON to a Azure IoT Hub and have the message routed to a Service Bus Queue using Azure IoT Hub’s built-in support for routing to Custom Endpoints.

{
“deviceId”: “2876123487623984769”,
“deviceEvent”: “RT”,
“deviceEventRelay”: “11”,
“deviceFactor”: “a6f3v9c0”
}

I have monitored receipt of the message with Device Explorer, so I know it reaches the Hub, but the message never matches the following route query.

$body.deviceEventRelay = ‘11’

So, I wrote a C# program to send the message content (above) to the same Azure IoT Hub and, interestingly, that message was properly routed to the Service Bus Queue. This leads me to suspect that my Custom JSON is missing some body or header markup.

Does anyone know what values are used for required fields ContentType and ContentEncoding in the message header sent by the Particle Azure IoT Hub integration?

Other suggestions?

Help needed. Assistance appreciated. Thanks.


#2

Hello? Can someone from the Particle Team weigh in @KyleG . Thanks.


#3

@rickkas7 are you able to help?


#4

Good day @KyleG. This issue is really impacting my project schedule. Can a Particle team member help?


#5

Is Losant.com a consideration or do you need to stick with Azure IOT?

I found Losant.com much easier and more flexible to work with.


#6

@RWB Thanks for the suggestion. Losant looks interesting, though they could be more forthcoming with pricing info.

For this implementation, it may not be an option as our team already has a significant investment in Azure. Though, if the Particle :left_right_arrow: Azure IoT Hub integration issue isn’t addressed soon.


#7

All I can say is I’m impressed with Losant’s customizability on the back and front end. They have excellent support, and the platform is being developed by experienced developers who are making constant improvements to the platform. It’s just super easy to work with compared to everything else I have tried, especially Azure.

Check out their forum if you have questions.

Here is a simple dashboard I set up to view data from my garage as an example.

https://app.losant.com/dashboards/599c9a05b36c040007c6e20c


#8

@RWB Looking further at their documentation, I like it and can see where Losant could be extremely useful in our IoT backend efforts. I will definitely be doing a deeper dive to gain more insight into their IoT platform. Thanks for sharing about Losant and your experiences.

@KyleG My research seems to indicate that there is an Azure API discrepancy (possibly ContentType and/or ContentEncoding settings) in the Particle side of the Azure IoT Hub integration. As we are bound (client) to use Azure IoT Hub routing as the distribution mechanism, I find it necessary to pursue this issue. Can you provide feedback? Is someone working this? If so, a timeline? Maybe a workaround? Help needed!!


#9

Hi up @jeiden, he created the Azure integration


#10

@Storm – working on a fix to add these headers to our integration by default. Will post here when it’s out on production.


#11

All,

We just deployed a fix to ensure that we are setting both headers to support Azure IoT Hub Endpoint routing:

Content-Type: application/json
Content-Encoding: utf-8

will now be set on all outbound requests to Azure IoT Hub. @Storm hopefully this unblocks you.

Jeff


#12

@jeiden Great. It works! Thanks for getting this fixed.

@RWB I appreciate the assist.