Module: AceMQ::AMQP::Headers

Defined in:
lib/acemq/amqp/headers.rb

Overview

The names AceMQ puts on the wire.

These are the contract between languages, not an implementation detail of this one. A Ruby consumer reads what a Java producer wrote because both agree on the strings here and on the types of their values, so nothing is renamed for Ruby's benefit: x-acemq-first-seen stays hyphenated and stays epoch milliseconds, however un-Rubyish that looks.

Pinned by spec/fixtures/envelope-fixtures.json, which the Java implementation produces and Go and .NET are held to as well.

Constant Summary collapse

ID =

The unique message identifier, and the default idempotency key.

"x-acemq-id"
TYPE =

The logical message type, for example order.placed.v2.

"x-acemq-type"
VERSION =

The schema version of the payload, an integer starting at 1.

"x-acemq-version"
CORRELATION =

The business correlation identifier, propagated across hops.

"x-acemq-correlation"
CAUSATION =

The message that caused this one, absent when there was none.

"x-acemq-causation"
ATTEMPT =

The delivery attempt, an integer starting at 1.

"x-acemq-attempt"
FIRST_SEEN =

When the message was first published, as epoch milliseconds.

"x-acemq-first-seen"
ORIGIN =

The publishing process, conventionally service@host.

"x-acemq-origin"
ERROR =

Why a message was dead-lettered, present only when it was.

"x-acemq-error"
CLAIM =

The claim-check URI, when the payload lives outside the message.

"x-acemq-claim"
ROUTE =

The ordered step names of a declared pipeline, comma-separated; which of them is next, counting from zero; and the identifier of one run through the pipeline, stable across every hop.

The itinerary as Java writes it, resolved against a Patterns::Pipeline rather than carrying its own destinations. Ruby's own acemq-routing-slip is the self-describing form and stays the default; these three are what makes a Ruby step able to stand in a Java-declared pipeline. See Patterns::RoutingSlip.

"x-acemq-route"
ROUTE_POSITION =
"x-acemq-route-position"
ROUTE_ID =
"x-acemq-route-id"
PREFIX =

The prefix every reserved name shares.

"x-acemq-"
ROUTE_HEADERS =

The three the itinerary is written in, in the order they are read.

[ROUTE, ROUTE_POSITION, ROUTE_ID].freeze
RESERVED =

Every name this library writes and understands.

[ID, TYPE, VERSION, CORRELATION, CAUSATION, ATTEMPT,
FIRST_SEEN, ORIGIN, ERROR, CLAIM, *ROUTE_HEADERS].freeze

Class Method Summary collapse

Class Method Details

.reserved?(name) ⇒ Boolean

Whether a header belongs to AceMQ rather than to the application.

Matched on the prefix rather than on the known set: a header from a newer version of another language's library is still not the application's, and handing it back as though it were would have an application unknowingly copy it onto a message it publishes.

Parameters:

  • name (String) —

    a header name

Returns:

  • (Boolean) —

    whether AceMQ reserves it



92
93
94
# File 'lib/acemq/amqp/headers.rb', line 92

def self.reserved?(name)
  name.to_s.start_with?(PREFIX)
end