Package ai.signalroom.kafka.isotope
Class IsotopeProducerInterceptor<K,V>
java.lang.Object
ai.signalroom.kafka.isotope.IsotopeProducerInterceptor<K,V>
- All Implemented Interfaces:
AutoCloseable,org.apache.kafka.clients.producer.ProducerInterceptor<K,,V> org.apache.kafka.common.Configurable
public class IsotopeProducerInterceptor<K,V>
extends Object
implements org.apache.kafka.clients.producer.ProducerInterceptor<K,V>
Producer-side half of the isotope tracer.
On every send(), this interceptor finds (or creates) the in-flight
Isotope, appends a hop describing this produce edge, and writes the
JSON-encoded isotope plus seven scalar headers describing the just-appended
hop. Sourcing order: thread-local context, inbound header, or a fresh trace
stamped with "isotope.service.name"<K,
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidvoidonAcknowledgement(org.apache.kafka.clients.producer.RecordMetadata metadata, Exception exception) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.clients.producer.ProducerInterceptor
onAcknowledgement
-
Field Details
-
SERVICE_NAME_CONFIG
- See Also:
-
PIPELINE_NAME_CONFIG
Names the logical pipeline a fresh trace belongs to (e.g.ordersvslocation). Only the trace's origin uses this value — it is stamped once atIsotope.newTrace(java.lang.String)and then forwarded unchanged on every hop, so downstream services inherit it from the inbound record and never need to set it.- See Also:
-
-
Constructor Details
-
IsotopeProducerInterceptor
public IsotopeProducerInterceptor()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceorg.apache.kafka.common.Configurable
-
onSend
-
onAcknowledgement
public void onAcknowledgement(org.apache.kafka.clients.producer.RecordMetadata metadata, Exception exception) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.kafka.clients.producer.ProducerInterceptor<K,V>
-