Ingest data from Rest API to Azure Event Hub Constantly

910 views Asked by At

At the moment I am trying to build a python process which constantly listen for new events that come from a Rest API using server-send-events (SSE/EventSource) and then ingest those into Azure event hub automatically.

So what is the best practice to automate those steps? Using Azure Functions with some kind of trigger? Or just running an infinte loop in a script in which an API listener gets the data and put it to the event hub?

1

There are 1 answers

0
Ivan Glasenberg On

If you want to constantly listen for new events, then ingest them into azure event hub, then you should choose to use the second solution: running an infinite loop in a script in which an API listener gets the data and put it to the azure event hub.

Or you can consider using azure webjob, then deploy the webjob as continuous.

For azure function, although you can ingest those events into azure event hub by using Azure Event Hubs output binding, but you can not constantly listen for new events by using any triggers(For example, if you're using timer trigger, it will execute the listening code just in the specified times, which is not constantly).