唐Walle
唐Walle

Reputation: 1

Why Azure function been triggered by Event Grid about every 2 munites

I am learning Azure Service Bus and Functinos. I have created a Service Bus namespace, a topic under the namespace and a subscription to the topic.

Then I bind the Event Grid of the Service Bus namespace to the EndPoint of an Azure function to process the SB messages.

When I sent several messages to the Service Bus topic, I can see from the "Monitor" of the Azure function, it was triggered about every 2 munites. The function does nothing but output the message, won't take long. I expected the function to be triggered whenever there is a messages sent to the topic, but seems not, why it is like this?

BTW, if I want to keep the Azure function to receive and process message one by one(Not in a parallel), how can I config it?

Thanks

Upvotes: 0

Views: 625

Answers (1)

Sean Feldman
Sean Feldman

Reputation: 25994

This is a normal behaviour for EventGrid for Azure Service Bus and is documented here.

The events are emitted immediately if there are no messages in the Service Bus entity and a new message arrives. Or the events are emitted every two minutes unless Service Bus detects an active receiver. Message browsing does not interrupt the events.

The idea is not to poll for new messages and instead, emit a notification event. Once Function is finished, messages are likely to arrive and if not picked up previously, after two minutes Event Grid will emit an event.

BTW, if I want to keep the Azure function to receive and process message one by one(Not in a parallel), how can I config it?

A Function attributed with [Singleton] should do the job.

Upvotes: 1

Related Questions