Spark.io, creators of the most excellent Spark Core device are now known as Particle! Please keep in mind as a reader that the following information applies to the Spark Core device as well as Particle Core.
In a previous post I discussed sending messages from a Spark Core Device to Azure Event Hubs by means of an Azure Mobile Service Proxy. The solution raises a variety of concerns around security and is a bit cumbersome to implement. It was then revealed to me that Spark (now Particle) employs a WebHooks service that can allow for triggering a request to a remote endpoint. I had the experience of working together with David Middlecamp from Particle’s engineering team to create an extension for enabling Azure Event Hubs through this service. In this post, I will guide you through setting up an Particle WebHook capable of sending data to an Azure Event Hub.
- Create an Azure Event Hub and configure a Shared Access Policy with the Send permission enabled
- Install the Particle CLI tool on your operating system of choice (You may skip the portion on enabling DFU-Util)
- Create a new file named webhook.json with a structure similar to the following (See: Particle Webhooks Documentation):
- Launch the Particle CLI tool (Open CMD prompt on Windows) and type “particle login” then login with your particle.io credentials
- Navigate to the folder containing webhook.json and type “particle webhook create webhook.json”
- Verify your webhook was created with “particle webhook list”
- Now in the Particle Web IDE you can send data to your Azure Event Hub using “Spark.publish(“NAME_OF_YOUR_EVENT“, payload);”
- Verify your data is sending appropriately from the Particle CLI tool by running “particle subscribe mine”
Particle.io is an excellent device for microcontroller prototyping, especially where web connectivity is required. I have found my Particle Core devices are extremely resilient, being 100% operational after using non-stop for months at a time. The device is even smart enough to reconnect if the network goes out. As a result, I believe this device to be a an excellent contender in the Internet of Things space. Furthermore, now that the device supports Azure Events Hubs via WebHooks, one can relatively easily craft a scenario involving up to 1 million messages coming in per second for processing via Microsoft Azure. For a full working example, check out this implementation of Particle WebHooks in the open-source ConnectTheDots project from MSOpenTech.