Enrich
ShipmentScheduled enriched with the carrier's mode and tracking link twice over: a Camel Content Enricher that calls shipping-service per record, and a Kafka Streams left join against a local copy of a compacted topic.
examples/19-enrich/ has two services. shipping-service owns the carrier reference data and serves it over HTTP. notification-service reads ShipmentScheduled and writes it enriched, through a Camel route and through a Kafka Streams topology, each to its own topic. It accompanies Enrich.
It uses Quarkus, Kafka Streams, Hibernate ORM with Panache, Flyway, Quarkus REST, Camel Kafka and HTTP, PostgreSQL, Kafka and OpenTelemetry to the LGTM stack.
(cd examples/domain-model && mvn -B -q install)
cd examples/19-enrich
mvn -B verify
./verify.sh
What to observe
- Both forms produce the same record. The same shipment has the same mode and link on both output topics.
- A reference change reaches the two forms at different times. A shipment scheduled before the new template is published gets the new link from the lookup and the old link from the join.
- An output is not revised. The earlier shipment keeps the link it was enriched with.
- A stopped owner stalls the lookup and not the join. The Camel group has lag 1 until the owner returns, then the record is enriched and nothing is lost.
- A deleted reference keeps the record. The join forwards the shipment with an empty mode and link.
- A recreated enricher rebuilds its copy from the topic.
Infrastructure
Kafka, PostgreSQL and the LGTM stack from examples/_infra, a one-shot container that creates the four topics with one partition each (the carrier topic compacted), shipping-service and notification-service. The compose project is edp-19.