3
votes

I have a quick question about sending messages to a partition in an event hub in Azure. If you have 32 partitions in an event hub what is the numbering?

Is it 0 to 31 or 1 to 32?

I'm assuming 0 to 31 but I wanted to confirm.

https://{servicebusNamespace}.servicebus.windows.net/{eventHubPath}/partitions/{partitionId}/messages

2

2 Answers

2
votes

Azure EventHubs partition numbering is from 0-X as of today (01/24/2018).

However, Microsoft Azure EventHubs partition numbering SHOULD NOT be used for sending to EventHubs. This specific number being the partition name/identifier - is purely an implementation detail.

Use EventHubClient.GetEventHubRuntimeInformation API to fetch the partitionIds list. Then use EventHubRuntimeInformation.PartitionIds[index] to create the Sender.

This is generalization built-in to support scenarios - if the Service ever provides - capabilities like - splitting a large partition etc., and then being able to give them names after splitting like - 2-1, 2-2 (supposing the original partition 2 was very large and split)..

more on Event Hubs...

0
votes

The numbering is zero-based. Below picture shows 4 partitions of Event Hub in Service Bus Explorer tool:

enter image description here