How to send data to a specific Azure Event Hub partition key

Bina Trivedi 6 Reputation points
2022-10-26T13:55:42.54+00:00

Hii,
I am trying to send data from the spring boot application to the azure event hub,
I have created an event hub inside an azure event namespace, with the three partitions.

I have to send a specific message to a particular partition.

for eg.
"Message1" on Partition 1
"Message2" on Partition 2
"Message3" on Partition 3
I Referred to the following link for sending data to the event hub
https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send-legacy

254413-image.png

The above image shows, if we add the partition key then msg will send to a specific partition.

but I am unable to find the partition key for a specific partition.

is there any way to find the partition key?

also, I wanted to know the difference between a partition key and a partition ID.

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
556 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruno Lucas 4,411 Reputation points MVP
    2022-10-27T09:04:41.34+00:00

    Hi @Bina Trivedi

    It seems to be the partition number

    When you create a hub you can't give it a name, only pick the amount of partitions:

    254580-image.png

    the ID is the partition number :

    254639-image.png

    I couldn't find that on the azure portal hub view. I use this tool : https://github.com/paolosalvatori/ServiceBusExplorer

    But you can also confirm with code

    254752-image.png

    I used this C# sample : https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send
    but you can also follow the receiver part from that java link you are following:

    254753-image.png

    that tool I shared above can send events to a specific partition:
    254754-image.png

    Case that information helps, don't forget to vote or mark as Answer to help the community. Cheers!

    0 comments No comments