208c6139d1 | ||
---|---|---|
.. | ||
src | ||
.dockerignore | ||
.gitignore | ||
Dockerfile | ||
README.md | ||
azuredeploy.json | ||
package.json | ||
tsconfig.json |
README.md
Sample adapter for the Device Bridge
This sample adapter written in TypeScript forwards D2C messages to an Event Hub. The code uses a client automatically generated by autorest using the Device Bridge swagger. Failures are logged in the same Log Analytics workspace used by the Bridge core module.
NOTE: this code should only be used as a sample reference for how to build adapters for the Device Bridge. It should not be used in a production setting without proper testing and error handling.
Deployment template
The template below is a modified version of the deployment template in the repository root to include the adapter container. It modifies the webserver configuration to route traffic to the adapter instead of the Bridge core module.
APIs
Subscribe
POST /subscribe/{deviceId}
Creates a C2D message subscription for a device and forwards all C2D messages to an EventHub.
Unsubscribe
POST /unsubscribe/{deviceId}
Deletes the C2D message subscription for a device and stops publishing events.