https://github.com/senssei/azure-eventhub-kafka-c
Sample C/C++ consumer and producer implementation for Azure EventHub with Kafka surface
https://github.com/senssei/azure-eventhub-kafka-c
azure-eventhub c cpp kafka kafka-consumer kafka-producer librdkafka
Last synced: about 2 months ago
JSON representation
Sample C/C++ consumer and producer implementation for Azure EventHub with Kafka surface
- Host: GitHub
- URL: https://github.com/senssei/azure-eventhub-kafka-c
- Owner: senssei
- License: mit
- Created: 2022-10-21T21:00:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-22T07:05:35.000Z (over 2 years ago)
- Last Synced: 2025-02-03T23:48:51.744Z (4 months ago)
- Topics: azure-eventhub, c, cpp, kafka, kafka-consumer, kafka-producer, librdkafka
- Language: C
- Homepage:
- Size: 330 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample C/C++ consumer and producer implementation for Azure EventHub with Kafka surface
Since there I wasn't able to find any exisiting libraries for connecting to Azure [EventHub](https://learn.microsoft.com/en-us/azure/event-hubs/) from C/C++ using native [EventHub Kafka surface](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-for-kafka-ecosystem-overview) capabilities and using `librdkafka` to achive it.
> Exisiting EventHub AMQP capacities could be used to reach the same level using either [`azure-uamqp-c`](https://github.com/Azure/azure-uamqp-c) or [`Qpid Proton`](https://qpid.apache.org/proton/index.html)
## Azure EventHub setup
https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create
> Create EventHub Namespace with minimum **Standard** tier since Kafka Surface is not avaiaible in Basic tier.

After creating *EventHub* within *EventHub Namespace* for the configuration we will need *Hostname* and Shared access policies *Connection String*.

## Build and run
Copy `getting-started.ini.sample` file to `getting-started.ini` and update fields with `XXXXXX` based on the information from *EventHub* configuration.
> Examples assumes the *Event Hub name* (topic name) is `purchases`.
### Consumer
```
docker build -f Dockerfile.consumer . azure-eventhub-kafka-c-consumer:latest
``````
docker run azure-eventhub-kafka-c-consumer:latest
```### Producer
```
docker build -f Dockerfile.producer . azure-eventhub-kafka-c-producer:latest
``````
docker run azure-eventhub-kafka-c-producer:latest
```
## Materials and references
* https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-for-kafka-ecosystem-overview
* https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-kafka-connect-debezium
* https://docs.confluent.io/kafka-clients/librdkafka/current/overview.html
* https://developer.confluent.io/get-started/c/#introduction
* https://packages.debian.org/pl/sid/librdkafka-dev
* https://github.com/edenhill/librdkafka
* https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/quickstart/java
* https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/quickstart/kafkacat