Librdkafka comes with a few C++ examples that can be used with Event Streams.
For example, for Event Streams on Cloud, using the rdkafka_example_cpp
sample:
To produce, run:
./rdkafka_example -P -t <TOPIC> -b <BOOTSTRAP_SERVERS> \
-X security.protocol=SASL_SSL -X sasl.mechanisms=PLAIN -X sasl.username=<USERNAME> \
-X sasl.password=<PASSWORD> -X ssl.ca.location=<CA_PATH> -X api.version.request=true \
-X broker.version.fallback=0.10.2.1 -X log.connection.close=false
To Consume, run:
./rdkafka_example -C -t <TOPIC> -p 0 -b <BOOTSTRAP_SERVERS> \
-X security.protocol=SASL_SSL -X sasl.mechanisms=PLAIN -X sasl.username=<USERNAME> \
-X sasl.password=<PASSWORD> -X ssl.ca.location=<CA_PATH> -X api.version.request=true \
-X broker.version.fallback=0.10.2.1 -X log.connection.close=false
Replace the placeholders between <>
with your Event Streams credentials.
See how the arguments passed with -X
are used in the example to build a Config: https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp#L342-L375