Introduction

Enzo Server
  Installation
  Quick Start
  Core Features
    Async Calls
    ConnectionStrings
    Edge Cache
    HTTP Access
    Scheduling
    Views
  Advanced Capabilities
    Change Data Capture
  Administration
    Configuration Settings
    Logins & ACL
    Auditing
    Current Executions
    Linked Server
    SSL

  User Guides
     Sharding
     Sharding Overview

     SharePoint

   Adapters
    All Adapters
    Azure Bus
    Azure IoT Hub
    Azure Key Vault
    Azure Storage
    Couchbase
    CSV
    DB (RDBMS)
    Files
    Flight Aware
    FTP
    Geonames
    HttpEndpoint (REST)
    Insteon
    Loggly
    Messaging (SMS/SMTP)
    MongoDB
    Motus
    MSAD
    MSMQ
    Pipeline
    Pressero
    RabbitMQ
    SalesForce
    Shard
    SharePoint
    SQL Server
    Threading
    Twilio
    Twitter
    VellemanDMX
    Weather (Underground)
    Whiparound
    WMI
    Xls (Excel)
    ZIP


  SDK
    Overview
    Installation
    DevHost
    Create A Simple Adapter
    Handler Columns

    Advanced SDK Concepts
      Handler Decorators
      Dynamic Columns
      Table & Table Enumerators
      Virtual Tables

/adapters/azureiothub




Azure IoT Hub


This adapter allows you to connect to the Azure IoT Hub and manage IoT devices. In addition this adapter provides the ability to generate random IoT data to emulate devices.


Configuration Settings



Name Description Default
Boolean _isDefault Make this the default configuration. Defaults to true if configName is already the default.
String name The name of the configuration setting
String connectionStringSecret The connection string to the Azure IoT Hub
String transportType Preferred transport type AMQP
Boolean startMessageListener True to start the message listener thread for cloud to device communication False

Handlers



SendMessage Sends data to a device. details 

Arguments

Name Description Default
id R Id of the device to send a message to
data R The message to send to the device
messageId The unique message id (defaults to a Guid if not provided)
ack The acknowledgement of the device (full, success, failure, none) none

SQL Call

INSERT INTO AzureIoTHub.Message (id, data) VALUES ('dev', 'TEST') WHERE Id = 'dev'
exec AzureIoTHub.SendMessage 'dev', 'TEST'


Http Call

/bsc/azureiothub/sendmessage

Output Columns

String idId of the device to send a message to
String dataThe message to send to the device
String messageIdThe unique message id (defaults to a Guid if not provided)
String ackThe acknowledgement of the device (full, success, failure, none)
CreateDevice Creates a new device in an Azure IoT Hub. details 

Arguments

Name Description Default
id Id of the device. If none is provided, a random name will be assigned.
primaryKey The primary for the device. If none is provided (or it is null), a random key will be assigned.
secondaryKey The secondary for the device. If none is provided (or it is null), a random key will be assigned.

SQL Call

INSERT INTO AzureIoTHub.Devices (id) VALUES ('dev')
exec AzureIoTHub.CreateDevice
exec AzureIoTHub.CreateDevice 'dev'
exec AzureIoTHub.CreateDevice 'dev', 'yhdCIyP8JntgQMYdn3nxQk2EV9bsQLYMVF3EF1pE/Qg=', 'FPIkHoDsX9oo7CWc7Q6zsO6y9fYd3COLRJVnSA3+qgY='


Http Call

/bsc/azureiothub/createdevice

Output Columns

String idThe device name
String primaryKeyThe Primary Key of the device
String secondaryKeyThe Secondary Key of the device
String connectionStringThe connection string for this device
String connectionStateThe connection state of this device
DateTime lastActivityTimeThe last datetime the device was active
DateTime lastConnectionTimeThe last datetime the device connected
DateTime lastStateUpdateTimeThe last datetime the device updated its state
Int32 messageCountThe count of messages the device received from the azure IoT Hub
String stateThe state of the device
String suspensionReasonThe suspension reason for the device
CreateDevices Creates multiple devices in an Azure IoT Hub using a simple replacable format. details 

Arguments

Name Description Default
range R A numeric range separated by a dash. Ex: 0-9 or 50-99
id R The name of the device to create with a ? for numeric replacement. Ex: device? or us-?-sensor

SQL Call

exec AzureIoTHub.CreateDevices '50-99', 'testdevice?'


Http Call

/bsc/azureiothub/createdevices

Output Columns

String idThe device name
String primaryKeyThe Primary Key of the device
String secondaryKeyThe Secondary Key of the device
String connectionStringThe connection string for this device
String connectionStateThe connection state of this device
DateTime lastActivityTimeThe last datetime the device was active
DateTime lastConnectionTimeThe last datetime the device connected
DateTime lastStateUpdateTimeThe last datetime the device updated its state
Int32 messageCountThe count of messages the device received from the azure IoT Hub
String stateThe state of the device
String suspensionReasonThe suspension reason for the device
DeleteDevice Deletes a device in an Azure IoT Hub. details 

Arguments

Name Description Default
id R Id of the device.

SQL Call

DELETE FROM AzureIoTHub.Devices WHERE Id = 'dev'
exec AzureIoTHub.DeleteDevice 'dev'


Http Call

/bsc/azureiothub/deletedevice

Output Columns

This call does not return data.

DeleteDevices Deletes devices in an Azure IoT Hub. details 

Arguments

Name Description Default
range R A numeric range separated by a dash. Ex: 0-9 or 50-99
id R The name of the device to create with a ? for numeric replacement. Ex: device? or us-?-sensor

SQL Call

exec AzureIoTHub.DeleteDevice '0-10', 'dev?iot'


Http Call

/bsc/azureiothub/deletedevices

Output Columns

This call does not return data.

FlushDeviceCache Flushes the cached Device collection and underlying connection strings that improves connectivity performance. details 

Arguments


SQL Call

EXEC AzureIoTHub.FlushDeviceCache


Http Call

/bsc/azureiothub/flushdevicecache

Output Columns

This call does not return data.

GetDeviceMessages Returns pending device messages. details 

Arguments

Name Description Default
deviceId Id of the device
decode True if the message should be decoded using UTF8 0
peekOnly True if the list of messages should remain in the queue 0

SQL Call

exec AzureIoTHub.GetDeviceMessages 'dev'


Http Call

/bsc/azureiothub/getdevicemessages

Output Columns

String idThe device name
String correlationIdThe correlationId of the message
Int32 deliveryCountDelivery count for the message
DateTime enqueuedTimeUtcThe UTC time the message was enqueued
DateTime expiryTimeUtcThe UTC time the message will expire
String lockTokenThe lock token if any
String messageIdThe message unique identifier
Int64 sequenceNumberThe sequence number of the message
String toThe message TO attribute
String userIdThe user id sending the message
Object dataByte array of the payload
String data_utf8String of the payload (if requested with decode=1)
ListDevices Returns a list of devices that have been registered in an Azure IoT Hub. details 

Arguments

Name Description Default
id Id of the device starts with the string provided
count Count of devices requested

SQL Call

exec AzureIoTHub.ListDevices 'dev'


Http Call

/bsc/azureiothub/listdevices

Output Columns

String idThe device name
String primaryKeyThe Primary Key of the device
String secondaryKeyThe Secondary Key of the device
String connectionStringThe connection string for this device
String connectionStateThe connection state of this device
DateTime lastActivityTimeThe last datetime the device was active
DateTime lastConnectionTimeThe last datetime the device connected
DateTime lastStateUpdateTimeThe last datetime the device updated its state
Int32 messageCountThe count of messages the device received from the azure IoT Hub
String stateThe state of the device
String suspensionReasonThe suspension reason for the device
String countCount of devices requested
SendData Sends data from a device. details 

Arguments

Name Description Default
id R Id of the device to send data from
data R The data to send to the Azure IoT Hub
messageId Optional message identifier
properties List of key value pairs of properties for this message (ex: place=home,priority=high)
correlationId Optional correlation identifier
to Optional 'to' property of the message
userId Optional user identifier of the message

SQL Call

INSERT INTO AzureIoTHub.Data (id, data) VALUES ('dev', '{"server":"devlap03\Enzo","metric":"loginCount","value":7,"datetime":"2016-4-14 16:35:00"}') WHERE Id = 'dev'
exec AzureIoTHub.SendData 'dev', '{"server":"devlap03\Enzo","metric":"loginCount","value":7,"datetime":"2016-4-14 16:35:00"}'


Http Call

/bsc/azureiothub/senddata

Output Columns

String dateTimeServer time when the message was sent
String idThe device id that sent the message
String messageIdThe message unique identifier
String dataThe message sent
String propertiesProperties sent along with the message
String durationmsSend time in milliseconds
SendTestData Sends data from a set of devices. details 

Arguments

Name Description Default
msgCount R Minimum number of messages to send from devices
delayms R Delay in millisecond between data send operations
id R Comma-separated list of the device ids, or device groups, to send data from
data R The template data to send to the Azure IoT Hub (support functions: #deviceid(), #utcnow(), #utc(), #rndguid(), #rndint(min,max) )
properties List of key value pairs of properties for this message (ex: place=home,priority=high)
to Optional 'to' property of the message
userId Optional user identifier of the message

SQL Call

exec AzureIoTHub.SendTestData 100, 1000, 'device1,device2', '{"server":"devlap03\Enzo","metric":"loginCount","value":7,"datetime":"2016-4-14 16:35:00"}'
exec AzureIoTHub.SendTestData 100, 1000, '[group1],device55,[group2]', '{"server":"devlap03\Enzo","metric":"loginCount","value":7,"datetime":"2016-4-14 16:35:00"}'


Http Call

/bsc/azureiothub/sendtestdata

Output Columns

String dateTimeServer time when the message was sent
String idThe device id that sent the message
String messageIdThe message unique identifier
String dataThe message sent
String propertiesProperties sent along with the message
String durationmsSend time in milliseconds
UpdateDevice Updates a device in an Azure IoT Hub. details 

Arguments

Name Description Default
id R Id of the device.
primaryKey The primary for the device. If none is provided (or it is null), a random key will be assigned.
secondaryKey The secondary for the device. If none is provided (or it is null), a random key will be assigned.

SQL Call

UPDATE AzureIoTHub.Devices SET primaryKey = null WHERE Id = 'dev'
exec AzureIoTHub.UpdateDevice 'dev'
exec AzureIoTHub.UpdateDevice 'dev', 'yhdCIyP8JntgQMYdn3nxQk2EV9bsQLYMVF3EF1pE/Qg=', 'FPIkHoDsX9oo7CWc7Q6zsO6y9fYd3COLRJVnSA3+qgY='


Http Call

/bsc/azureiothub/updatedevice

Output Columns

String idThe device name
String primaryKeyThe Primary Key of the device
String secondaryKeyThe Secondary Key of the device
String connectionStringThe connection string for this device
String connectionStateThe connection state of this device
DateTime lastActivityTimeThe last datetime the device was active
DateTime lastConnectionTimeThe last datetime the device connected
DateTime lastStateUpdateTimeThe last datetime the device updated its state
Int32 messageCountThe count of messages the device received from the azure IoT Hub
String stateThe state of the device
String suspensionReasonThe suspension reason for the device