Microsoft Azure Event Hubs

Azure is a cloud platform provided by Microsoft. This platform has a lot of services to reach communication between machines and devices.

This section focuses on Event Hubs, we can refer this technology as a way to send short messages via HTTP REST request. Event Hubs is part of Service Bus. Event Hubs implements a simple message consumer M2M technology.

For more information about Event Hubs, see the following link:
https://azure.microsoft.com/en-us/services/event-hubs/

Setup in Azure - Creating NameSpace

Before getting the parameters to connect to Event Hub, it is necessary to create a Service Bus Namespace (skip this section if you already have one).

Go to the Azure Event Hub Portal:
https://manage.windowsazure.com

Select the Service Bus menu. At the bottom of the Bus service manager screen you will see a NEW button with a plus image, click on it. A pop-up window will appear where you must select message type "EVENT HUB".

Figure : Create new Namespace

Setup in Azure - Creating an Event Hub

In this section we will create an Event Hub that will receive our data from Meshlium. After we dive into the Service Bus we have previously created, we can see a menu on the top of the screen, then we should choose "Event Hubs" and "Create a New Event Hub":

Figure : Create New Event Hub \(i\)

After clicking on this menu, a new screen will appear. At this point we can create a new event hub clicking on the bottom left icon labeled as New:

Figure : Create a New Event Hub \(ii\)

After click this button, a pop-up window raises above and you are now able to create an event hub, we are going to choose "quick create" option to make this step easier:

Figure : Quick Create

Type your event hub name and click "Create a new event hub" button to finish the configuration process.

Figure : Type the new Event Hub name

You have created an Event hub for one day data retention, which means that your data will be kept one day.This method sets a partition section with value '4', which means the number of partitions the Event Hub may have.

Setup in Azure - Setting up shared access in Event Hub

We set up a shared directive to send data with custom credentials.Once we entered on event hub information (by clicking on event hub), these credentials can be set up in the configuration section, this menu is on top of the screen:

Figure : Configure the Event

Click on the "configure" option and a new screen will be displayed. Here you can configure message retention, event hub state, partition count and shared access policies. This last point (shared access policies) manages credentials to send and listen messages (or both action), we will create a new credential to send messages. On "shared access policies", type a name for your key, and in the permissions drop-down menu, select "Manage" permission. Then press "save" on the bottom of the screen.

Figure : Configure the Event Permissions

Finally, we will copy the information needed to connect the Event Hub connector. In order to do that, go to the "Dashboard" of the Event Hub and select "View Connection String".

Figure : Event Hub Dashboard

Copy the "Connection String" that appears in the screen.

Figure : Connection String

We will extract the information needed to connect the Meshlium from the "Connection String". You have to copy the NAMESPACE, the DIRECTIVE_NAME, the DIRECTIVE_KEY and the EVENTHUB_NAME from the string as the following example:

Namespace=Endpoint=sb://NAMESPACE.servicebus.windows.net/;SharedAccessKeyName=DIRECTIVE_ NAME;SharedAccessKey=DIRECTIVE_KEY;EntityPath=EVENTHUB_NAME  

Note that the namespace is only a part of the string Endpoint, it does NOT include the "sb://" neither the ".servicebus.windows.net/" part.

Configuration

As result of previous steps, we should have a namespace, a directive name, a directive key and an event hub name. These are the main properties we should set in the Manager System to configure an Event Hub connection.

Now we can access the Meshlium Manager and fulfill the Azure Event Hub fields with the previously obtained configuration.

Figure : Configuring Azure Event Hubs in Meshlium

Controlling synchronization

Once you have saved the configuration, you can start sending your data via Event Hub to your Azure Cloud by pressing the "Start" button. You will notice about it because the screen shows a spinning wheel when the process starts and displays a "running" status.

Figure : Azure Event Hubs synchronization service is running

If you want to stop this process just press the "Stop" button. You can start/stop this process whenever you want.

Figure : Azure Event Hubs synchronization service is stopped