1. Batch Message handling via Event Hub

What is Event Hub?

Azure Event Hubs is a scalable event processing service that ingests and processes large volumes of events and data, with low latency and high reliability.

  • Egress: Up to 2 MB per second or 4096 events per second.
  • Max TU: 20 (soft limit)
  • If you need more throughput, consider the premium or dedicated pricing tier.
  • 1 PU (processing unit; premium tier) = 5 TU ~ 10 TU
  • 1 CU (capacity unit; dedicated tier) = 100 TU ~ 250 TU
  • Partition numbers can only be changed on the premium tier or dedicated tier. If you want to change it on the standard tier, you can create a support ticket for help.
  • The partition count can be up to 2000 partitions per Capacity Unit in Event Hubs Dedicated tier.
  • 1 partition can afford up to 1 TU throughput.
  • reference: Understanding & Designing of Partitions and Throughput Unit

Support batching messages from binding Azure function

Setup with the following settings on the Azure function

  1. Set maxBatchSize on host.json

How Azure Function consumes Event Hub events

Azure Function consumes Event Hub events while cycling through the following steps:

  1. When new messages are received (in a batch by default), the host attempts to trigger the function with the batch of messages.
  2. If the function completes execution (with or without exception) the pointer advances and a checkpoint is saved to the storage account.
  3. If conditions prevent the function execution from completing, the host fails to progress the pointer. If the pointer isn’t advanced, then later checks end up processing the same messages.
  4. Repeat steps 2 to 4.
  • Functions guarantee at-least-once delivery. Your code and dependent systems may need to account for the fact that the same message could be received twice.

2. Batch Message handling via Service Bus

What is Service Bus?

Service Bus is a fully managed enterprise message broker with message queues and publish-subscribe topics.

Support batching messages from binding Azure function

Setup with the following settings on the Azure function

  1. Set maxMessageCount on host.json
  2. Update extensionBundle version to [2.*, 3.0.0)
  3. The batch Message feature is available in service bus extension 4.2.0 and above.

3. Event Hubs vs. Service Bus

Choose Event Hub or Service Bus based on your workload and usage scenarios.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store