On Azure Eventhub Can i have a kafka producer and a Eventhub client consumer for the same events ?

Christian Johansen 0 Reputation points
2025-05-28T10:08:53.28+00:00

I produce events via .net confluent kafka client and send via :9093 kafka endpoint
can those events be consumed by a non kafka .net azure eventhub EventProcessorClient?
does mapping of headers happen automatically ? from byte array to string ?

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

1 answer

Sort by: Most helpful
  1. J N S S Kasyap 3,300 Reputation points Microsoft External Staff Moderator
    2025-05-28T10:30:13.4966667+00:00

    Hi @Christian Johansen

    On Azure Eventhub Can i have a kafka producer and a Eventhub client consumer for the same events ?

    Yes, you can produce events to Azure Event Hubs using a Kafka producer (e.g., .NET Confluent Kafka client via port 9093) and consume those events using a non-Kafka .NET client such as EventProcessorClient.

    https://learn.microsoft.com/en-us/azure/event-hubs/azure-event-hubs-apache-kafka-overview

    can those events be consumed by a non kafka .net azure eventhub EventProcessorClient?

    Yes, events sent to Event Hubs using a Kafka producer are stored in partitions the same way as native Event Hubs events and can be consumed using the EventProcessorClient. 

    https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-about

    does mapping of headers happen automatically ? from byte array to string ?

    No, header values sent via Kafka producers are typically stored as byte[] in the EventData.Properties dictionary. The conversion to string is not automatic,you must manually deserialize the headers in your consumer logic.

    https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.eventhubs.eventdata.properties?view=azure-dotnet
    https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-faq

    if the above answer was helpful. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.