Class AceHeaders

java.lang.Object
org.acemq.amqp.api.AceHeaders

public final class AceHeaders extends Object
The message header names that make up the AceMQ cross-language contract.

These names are the interoperability surface of the whole project. A Go publisher and an Elixir consumer agree because they agree on these strings, and a service that does not use AceMQ at all can still read them. They are frozen at specification version 1: renaming one is a breaking change for every language port simultaneously.

Two groups of names here deliberately do not carry the x-acemq- prefix. Trace context does not, because traceparent and tracestate are W3C names that other tools already know how to read. The SHARED_PREFIX names do not, because they are written by a pattern rather than by the engine and have to reach the handler: a header in the reserved namespace is stripped on consume, which for these would mean writing them and finding them gone.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Delivery attempt counter, starting at 1 and incremented by the retry engine.
    static final String
    Identifier of the message that caused this one to be published.
    static final String
    Where the payload is, when the application stores it outside the message.
    static final String
    Business correlation identifier, propagated unchanged across hops.
    static final String
    Why a message was dead-lettered.
    static final String
    Epoch milliseconds of the first publish, used for age-based give-up.
    static final String
    Unique message identifier, and the default idempotency key.
    static final String
    Identifier of the publishing process, conventionally service@host.
    static final String
    The engine's namespace.
    static final String
    How many times the message has been replayed.
    static final String
    When the message was last replayed.
    static final String
    Queue a message was replayed from, set by the replay API for auditing.
    static final String
    Queue a request's reply should be sent to.
    static final String
    A responder's failure, carried back to the requester on the reply.
    static final String
    A self-describing itinerary: the stops a message still has to make, as JSON.
    static final String
    The namespace AceMQ defines but does not reserve.
    static final String
    W3C trace context.
    static final String
    W3C trace state.
    static final String
    Logical message type, for example order.placed.
    static final String
    Schema version of the payload, as an integer.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isAceHeader(String headerName)
    Reports whether a header name belongs to AceMQ.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREFIX

      public static final String PREFIX
      The engine's namespace.

      Reserved. A header carrying this prefix is treated as the engine's, materialised as a field on the Envelope if it is one this version knows about, and dropped from the application's headers either way. Putting your own header here means writing it on publish and finding it gone on consume, with nothing reporting the loss.

      Use a namespace of your own — x-yourcompany- — for anything the application or a pattern needs to survive the round trip.

      See Also:
    • SHARED_PREFIX

      public static final String SHARED_PREFIX
      The namespace AceMQ defines but does not reserve.

      A header here is one AceMQ writes and reads, but it is an ordinary application header on the wire: isAceHeader(java.lang.String) does not match it, Envelope.Builder.header accepts it, and it survives to the handler like any other. That is the whole point. A responder has to read the reply address out of the message it was handed, and a handler has to be able to see that the message it is looking at came back off a dead-letter queue. Put either in the reserved namespace and the engine eats it on the way in.

      Go, Python and Ruby use exactly these strings for exactly these headers. Java used to put the replay three in the reserved namespace, and was alone in doing so.

      See Also:
    • ID

      public static final String ID
      Unique message identifier, and the default idempotency key.
      See Also:
    • TYPE

      public static final String TYPE
      Logical message type, for example order.placed.
      See Also:
    • VERSION

      public static final String VERSION
      Schema version of the payload, as an integer.
      See Also:
    • CORRELATION

      public static final String CORRELATION
      Business correlation identifier, propagated unchanged across hops.
      See Also:
    • CAUSATION

      public static final String CAUSATION
      Identifier of the message that caused this one to be published.
      See Also:
    • ATTEMPT

      public static final String ATTEMPT
      Delivery attempt counter, starting at 1 and incremented by the retry engine.
      See Also:
    • FIRST_SEEN

      public static final String FIRST_SEEN
      Epoch milliseconds of the first publish, used for age-based give-up.
      See Also:
    • ORIGIN

      public static final String ORIGIN
      Identifier of the publishing process, conventionally service@host.
      See Also:
    • CLAIM

      public static final String CLAIM
      Where the payload is, when the application stores it outside the message.

      Materialised as Envelope.claim(). Set by the application, never by the engine, and never interpreted by it — it is for an operator reading a dead-letter queue.

      Not written by the claim-check pattern, which frames its reference in the body and sets no header, because a header can be stripped by a shovel or a federation link. All five libraries make that choice deliberately.

      See Also:
    • ERROR

      public static final String ERROR
      Why a message was dead-lettered. Present only on messages in a dead-letter queue.
      See Also:
    • REPLY_TO

      public static final String REPLY_TO
      Queue a request's reply should be sent to.

      Written alongside AMQP's own reply-to property rather than instead of it, and read in preference to it. The property is the older of the two and the one a non-AceMQ service understands; the header is what Go, Python and Ruby have always written, and the only one of the pair that survives a broker hop that rebuilds the message. Writing both and reading either is what lets a requester in one language be answered by a responder in another, in both directions and whichever of them is older.

      See Also:
    • RESPONDER_ERROR

      public static final String RESPONDER_ERROR
      A responder's failure, carried back to the requester on the reply.

      Its value is the failure as text (ExceptionType: message from this library, Python and Ruby; the error's text from Go). A requester reads it before decoding the body and raises it as the responder's failure, so an answer that failed is never mistaken for an answer, nor for an undecodable one. Not to be confused with ERROR, which says why a message was dead-lettered.

      See Also:
    • ROUTING_SLIP

      public static final String ROUTING_SLIP
      A self-describing itinerary: the stops a message still has to make, as JSON.

      The other half of RoutingSlip.ROUTE, which names steps and leaves a declared pipeline to say where each one lives. This header carries the exchange and routing key of every stop with it, so a consumer that has never heard of the pipeline can still send the message on. Go, Python and Ruby write this one; a declared pipeline is the better model when there is a declaration, and this is what there is when there is not.

      See Also:
    • REPLAYED_FROM

      public static final String REPLAYED_FROM
      Queue a message was replayed from, set by the replay API for auditing.
      See Also:
    • REPLAYED_AT

      public static final String REPLAYED_AT
      When the message was last replayed.
      See Also:
    • REPLAY_COUNT

      public static final String REPLAY_COUNT
      How many times the message has been replayed.

      Worth carrying separately from the attempt count, which a replay resets. A message on its fifth trip through a dead-letter queue is saying something that a fresh-looking attempt counter would hide.

      See Also:
    • TRACEPARENT

      public static final String TRACEPARENT
      W3C trace context. Not prefixed, so non-AceMQ tooling recognises it.
      See Also:
    • TRACESTATE

      public static final String TRACESTATE
      W3C trace state. Not prefixed, for the same reason as TRACEPARENT.
      See Also:
  • Method Details

    • isAceHeader

      public static boolean isAceHeader(String headerName)
      Reports whether a header name belongs to AceMQ.

      Useful when copying headers between messages: AceMQ-owned headers are re-derived by the engine rather than propagated verbatim.

      Parameters:
      headerName - header name to test, may be null
      Returns:
      true if the name carries the PREFIX