Why this matters
- VaultCommerce order-service creates one
KafkaProducerper JVM at startup — expensive to construct per request. - Serializer choice (String vs Avro) is fixed at producer creation and affects Schema Registry integration.
bootstrap.serversis only for initial metadata discovery — producers learn partition leaders dynamically.- First hands-on step before tuning acks, batching, or idempotence.
ApplicationVaultCommerce OrderService
Serializer
Record batch
Broker leader
Minimal producer configuration
VaultCommerce's baseline producer sets bootstrap.servers to all three seed brokers, StringSerializer for keys (orderId), and KafkaAvroSerializer for values registered in Schema Registry. client.id includes pod name for traceability in broker logs.
Key points
- bootstrap.servers — initial broker list for cluster metadata discovery
- Serializers — convert key/value objects to bytes before send
- client.id — logical name in broker metrics and logs
- KafkaProducer — thread-safe; share one instance across application threads
- ProducerRecord — topic, optional partition, key, value, headers, timestamp
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 2 sections
- Lifecycle and resource management
- VaultCommerce rollout checklist
Test yourself
Answer these before moving on — recall is what makes it stick.