Partager via


Get started with the Azure Event Hubs connector

Connect to Azure Event Hubs to send and receive events. You can perform operations such as send an event to an Event Hub and receive events from an Event Hub.

To use any connector, you first need to create a logic app. You can get started by creating a logic app now.

Connect to Event Bus

Before your logic app can access any service, you first need to create a connection to the service. A connection provides connectivity between a logic app and another service.

Prerequisites

You must have an Event Hubs account.

Before you can use your Azure Event Hubs account in a logic app, you must authorize the logic app to connect to your Event Hubs account. Fortunately, you can do this easily from within your logic app on the Azure portal.

Here are the steps to authorize your logic app to connect to your Event Hubs account:

  1. To create a connection to Event Hubs, in the logic app designer, select Show Microsoft managed APIs in the drop-down list. Then enter event hubs in the search box. Select the trigger or action you want to use.event_hubs_trigger_search

  2. If you haven't created any connections to Event Hubs before, you'll be prompted to provide your Event Hubs credentials. These credentials are used to authorize your logic app to connect to and access your Event Hubs’ data. The Event Hubs connector needs the connection string for the Event Hubs namespace. It also requires Manage permissions. A good way to know if your connection string is for the namespace or a specific entity is if it contains the EntityPath parameter. If it does, it is not the right connection string for a logic app.event_hubs_namespace

  3. After you have received the connection string for the namespace, you can use it for the API connection in Logic Apps.event_hubs_connection

  4. Notice the connection has been created, and you are now free to proceed with the other steps in your logic app.

  5. event_hubs_trigger

    Use an Event Hubs trigger

    A trigger is an event that can be used to start the workflow defined in a logic app. Learn more about triggers.

    Here's how to use the Event Hubs - When events are available in Event Hub trigger to initiate a logic app workflow when new events are sent to an Event Hub.

    Note

    You will be prompted to sign in with your Event Hubs connection string if you have not already created a connection to Event Hubs.

    1. In the search box on the logic apps designer, enter event hubs. Then select the Event Hubs - When events are available in an Event Hub event_hubs_trigger_search
    2. The When an event in available in an Event Hub dialog box is displayed.event_hubs_trigger_3
    3. Enter the name of the Event Hub you would like the trigger to monitor. Optionally, you can also select a consumer group.
    4. event_hubs_trigger_2

    At this point, your logic app has been configured with a trigger. When new events are available in the Event Hub you selected, the trigger will begin a run of the other triggers and actions in the workflow.

    Use an Event Hubs action

    An action is an operation carried out by the workflow defined in a logic app. Learn more about actions.

    Now that you have added a trigger, it's time to do something interesting with the data that's generated by the trigger. Follow these steps to add the Event Hubs - Send event action. This action sends an event to an Event Hub.

    Follow these steps to create the send event action:

    1. Select + New step to add the action.
    2. Select Add an action. This opens a search box, where you can search for any action you would like to take. For this example, Event Hubs’ actions are of interest.nextaction
    3. Enter event hubs.
    4. Select Event Hubs - Send event as the action to takeevent_hubs_actions_search
    5. Enter the content for the event. This is required.
    6. Enter the event hub name to which the event will be sent. This is also required.
    7. Provide other details about the event. This is optional.send_event
    8. Save the changes to your workflow.savelogicapp

Comments

  • Anonymous
    April 14, 2017
    Hi Vinay,Can we trigger a logic app from a Event Hub?