Why this matters
- VaultCommerce uses async send with callbacks for order events; sync .get() only in the outbox relay where failure must be immediate.
- Callbacks run on the producer's I/O thread — keep them fast or offload heavy work.
- RecordMetadata carries partition, offset, and timestamp for tracing.
- Understanding sync vs async send prevents thread pool exhaustion under load.
ApplicationVaultCommerce OrderService
Serializer
Record batch
Broker leader
Async send with callbacks
The happy path: producer.send(record, (metadata, exception) -> { ... }). On success, log metadata.partition() and metadata.offset() for correlation with consumer processing. VaultCommerce attaches traceId in headers and logs it alongside broker metadata.
Key points
Future<RecordMetadata>— handle to in-flight send; completes on broker ack- Callback — invoked on success or failure; must not block
- RecordMetadata — partition, offset, timestamp, serialized sizes
- flush() — force send of all buffered records before shutdown
- max.block.ms — how long send() blocks when metadata or buffer is unavailable
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
- Blocking send for critical paths
- VaultCommerce rollout checklist
Test yourself
Answer these before moving on — recall is what makes it stick.