Skip to content

Connecting

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>-

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.

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.

bootstrap.servers=<broker>:9092
security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="<username>" password="<password>";
group.id=rogo-<PARTNERID>-my-service
auto.offset.reset=earliest
key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
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())

See the quickstart.

  • 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 eventTime per 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.
  1. Check the group starts with rogo-<PARTNERID>-. Another name is refused.
  2. Start from the beginning (auto.offset.reset=earliest). A quiet project may have data in only a few partitions.
  3. Run one consumer while testing. Extra consumers get partitions with no data and look idle.
  4. Change something on a device and watch for a state message.