routing messages to iot hub to azure event hub

Kavitha Rajasekaran
4 min readJul 31, 2023

--

In order to route the iot hub messages we have to follow the below steps:

Step:1 : Creating event hub

  1. go to azure portal and login in to the portal.
  2. in home screen search event hub.

3. after click the event hubs main page click create.

4. The side bar slider will open. we have to provide all the details in order to create event hub namespace.

5. An Event Hubs namespace provides a unique scoping container, referenced by its fully qualified domain name, in which you create one or more event hubs or Kafka topics. This feature provides an endpoint that enables customers to talk to Event Hubs using the Kafka protocol. This integration provides customers a Kafka endpoint.

6. Once provide all the for event hub namespace, it will create a eventhub namespace.

7. After creating the namespace go to resource group, then select the event hub namespace click the namespace it will open the below screen.

8. In this demo we have created practiceventub namespace. under that we are going to create event hub for just click the create option which is highlighted.

9. provide the name of the event hub. leave that partition count and message retention as default values. Then click the create button.

step:1 :creating iot hub

  1. go to portal.azure.com
  2. in home screen search box search for iot hub.

3. click create.

4. once provide all the details click Review + Create button.

5. go to resource group select the iot hub then click the created iot hub. Go to events that is in the left hand menu.

6. once click the events. click the event subscription + icon

7. filter to event type select what ever the option we want for example trigger it when the device is created, deleted etc..

8. click the endpoint type then the select event hub side bar will open like below screen. we have to select the event hub namespace and the event name which we have created in step1. then click confirm selection.

9. once provide all the options click create button.

step:3: Routing iot hub message to event hub

  1. Go to resource group. go to iot hub.
  2. select build in end point in the side left hand menu.

3. we can see the compatible end points value over there. copy that value and paste it in the note pad. we will use it later in this session.

step:4: creating event hub trigger function in the function app

  1. Go to resource group select function app which we created.(if you dont know how to create function app means go to main home screen of azure portal then provide function app in the search box then click create + icon. provide all the details then click create button that will create the function app)
  2. select function app. The below screen is displayed.
  3. click functions which are present in the left hand menu bar.

4. press + Add. Then the below screen will appear.

5. In template select Azure event hub trigger.

6. After selecting the template provide the event hub connection and event hub name which we created earlier in this season.

7. Press add button It will automatically a new function is added in the function app.

Step

--

--

No responses yet