This page walks through importing data from Apache Kafka into a graph using gqldb-importer. The importer connects to one or more brokers, consumes records from configured topics, and writes each record as a node or edge.
Records are expected to be JSON objects in the message value; the object's keys are mapped to property names the same way as JSON imports.
Make sure the Kafka brokers are reachable from the host where gqldb-importer will run, and that the configured topics already contain the records you want to import.
Bash./gqldb-importer -sample kafka
A file named import.sample.kafka.yml will be created in the current directory. Rename it before editing so a re-run of -sample kafka doesn't clobber your changes:
Bashmv import.sample.kafka.yml import.kafka.yml
Edit import.kafka.yml. Kafka-specific configuration lives under the top-level kafka: block; see the Import Configurations for the rest of the file (server, settings).
config snippetkafka: brokers: - "localhost:9092" nodes: - schema: "Person" topic: "users" offset: oldest # oldest, newest id_column: "_id" properties: age: int32 edges: - schema: "FOLLOWS" topic: "follows" offset: oldest from_column: "follower_id" to_column: "following_id"
brokers — list of bootstrap servers. Add as many as needed; the consumer will discover the rest of the cluster from these.The offset field on each entry controls where the consumer starts reading the topic:
| Value | Behavior |
|---|---|
oldest | Start at the earliest available offset (full backfill). |
newest | Start at the latest offset; only records produced after the import begins are consumed. |
Bash./gqldb-importer -c import.kafka.yml
settings.batch_size for throughput.settings.stop_on_error.