Need to pull azure event hub data into local API through event grid

Rajesh Kumar Sinha 0 Reputation points
2023-12-21T12:05:35.1+00:00

Hi,

I am looking for a solution to retrieve data from event hub to local app through event grid.

Basic flow :

1)Push dummy data to event hub and capture data

2)Read those captured data through event grid

3)retrieve the captured data from event grid into local API.

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
568 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
321 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2023-12-21T12:05:35.1033333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To retrieve data from Event Hub to a local app through Event Grid, you can follow these basic steps:

    1. Push dummy data to Event Hub and capture data using the Capture feature of Event Hubs.
    2. Create an Event Grid subscription to the Event Hub capture container.
    3. Create an Azure Function that is triggered by the Event Grid subscription and retrieves the captured data from the Event Hub capture container.
    4. The Azure Function can then process the data and send it to your local API.

    You can find more information on how to implement this solution in the following references:


    References:

    0 comments No comments

  2. AnnuKumari-MSFT 31,721 Reputation points Microsoft Employee
    2023-12-28T05:43:09.0366667+00:00

    @Rajesh Kumar Sinha ,

    Welcome to Microsoft Q&A platform and thanks for posting your query here.

    As per my understanding you are trying to pull azure event hub data into local API through event grid.

    Here are more detailed approach on the workflow you are trying to implement:

    Push dummy data to Event Hub and capture data using a consumer application. You can use the Azure Event Hubs SDK for .NET to create a consumer application that reads data from the Event Hub. You can follow the instructions in this document to create a consumer application.

    Create an Event Grid subscription to capture events from the Event Hub. You can follow the instructions in this document to create an Event Grid subscription that captures events from the Event Hub.

    Create an Azure Function or Web API to receive the events from Event Grid. You can use Azure Functions or Web API to receive the events from Event Grid. Here is an example of how to create an Azure Function to receive events from Event Grid:

    • Create a new Azure Function in Visual Studio or the Azure portal.
    • Add an Event Grid trigger to the function.
    • In the function code, parse the event data and extract the relevant information.
    • Process the event data as needed.
    1. Retrieve the captured data from Event Grid into the local API. Once the Azure Function or Web API receives the events from Event Grid, you can retrieve the captured data and use it in your local API. You can use the data in any way that is appropriate for your application.

    Note that Event Grid is a publish-subscribe messaging service, so it is designed to send events to subscribers rather than to retrieve data from it. However, you can use Event Grid to capture events from Event Hub and then process those events in an Azure Function or Web API to retrieve the data and use it in your local API.

    Hope it helps. Kindly accept the answer by clicking on Accept answer button. Thankyou

    0 comments No comments