@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.
- 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