Interface HeaderSender

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface HeaderSender
The produce-side out-of-band header seam for Tracing.publish(io.opentelemetry.api.trace.Tracer, String, java.util.Map, String, HeaderSender) — a Sender that also receives a Map<String, String> of out-of-band transport headers to carry beside the frozen envelope (GR-1), never inside it.

It is the Java counterpart of Go's App.PublishWithHeaders / Node's publish(..., send, {headers}): the OTel producer injects the active span's W3C traceparent into the map and hands it here, so a downstream consumer can start its span as a true child of the producer span (ADR-0028). The Map<String, String> is the same out-of-band header shape the core already agrees on for Redrive.HeaderPublisher (the replay-bypass marker, ADR-0027) and for Redrive.Reserved.headers().

An adapter carries the map on its transport's native per-message metadata channel (AMQP message headers, SQS MessageAttributes, a Redis transport-owned frame), merging it beside the contract bq-*/x-* headers. A transport with no such channel can ignore the map (or be reached through the plain Sender overload) — propagation then degrades to the v0.1 trace_id correlation with no error. The Java transports live in separate artifacts (babelqueue-java-sqs, babelqueue-java-redis, babelqueue-spring), so wiring this map onto each broker is a documented per-transport follow-up.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    send(Envelope envelope, Map<String,String> headers)
    Sends one already-built envelope together with its out-of-band transport headers.
  • Method Details

    • send

      void send(Envelope envelope, Map<String,String> headers) throws Exception
      Sends one already-built envelope together with its out-of-band transport headers.
      Parameters:
      envelope - the envelope to publish (its trace_id encodes the producer trace)
      headers - the out-of-band headers to carry beside the envelope (e.g. traceparent); never null, possibly empty when there is no active trace
      Throws:
      Exception - to signal a failed publish (recorded on the producer span and re-thrown)