Connecting
Connection
Section titled “Connection”| Setting | Value |
|---|---|
| Brokers | The address shown in the dashboard, port 9092 |
| Security | SASL_PLAINTEXT |
| SASL mechanism | SCRAM-SHA-512 |
| Username and password | A credential of the project |
| Topics | The .state and .evt topics shown in the dashboard |
| Consumer group | Must start with rogo-<PARTNERID>- |
Credentials
Section titled “Credentials”Create them in the dashboard, in Cloud Services → Data Streaming Services → Credentials.
- The password is shown once, when the credential is created. It cannot be shown again; if it is lost, create a new credential and revoke the old one.
- A project has at most two credentials. To replace one without downtime: create the second, move your consumers to it, then revoke the first.
- Revoking a credential disconnects every consumer using it.
- Credentials are separate from API keys: changing one never affects the other.
Consumer groups
Section titled “Consumer groups”Name your group rogo-<PARTNERID>-<anything>, for example rogo-ACME-billing. Use a separate group per
project or service: consumers of different projects in one group can end up with no partitions and
receive nothing, without an error.
Examples
Section titled “Examples”bootstrap.servers=<broker>:9092security.protocol=SASL_PLAINTEXTsasl.mechanism=SCRAM-SHA-512sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="<username>" password="<password>";group.id=rogo-<PARTNERID>-my-serviceauto.offset.reset=earliestkey.deserializer=org.apache.kafka.common.serialization.StringDeserializervalue.deserializer=org.apache.kafka.common.serialization.StringDeserializerPython
Section titled “Python”from confluent_kafka import Consumer
consumer = Consumer({ "bootstrap.servers": "<broker>:9092", "security.protocol": "SASL_PLAINTEXT", "sasl.mechanisms": "SCRAM-SHA-512", "sasl.username": "<username>", "sasl.password": "<password>", "group.id": "rogo-<PARTNERID>-my-service", "auto.offset.reset": "earliest",})consumer.subscribe(["<state topic>", "<event topic>"])while True: msg = consumer.poll(1.0) if msg is not None and not msg.error(): print(msg.topic(), msg.key(), msg.value().decode())Node.js
Section titled “Node.js”See the quickstart.
Delivery
Section titled “Delivery”- Order: messages of one device arrive in order. There is no order between devices.
- At least once: a message can be delivered twice. Keep the newest
eventTimeper device and ignore older ones. - The state topic keeps the latest message of every device. A new consumer group that starts from the beginning first receives the current state of every device, then the changes.
When nothing arrives
Section titled “When nothing arrives”- Check the group starts with
rogo-<PARTNERID>-. Another name is refused. - Start from the beginning (
auto.offset.reset=earliest). A quiet project may have data in only a few partitions. - Run one consumer while testing. Extra consumers get partitions with no data and look idle.
- Change something on a device and watch for a state message.