Package org.acemq.amqp.api
Class Envelope.Builder
java.lang.Object
org.acemq.amqp.api.Envelope.Builder
- Enclosing class:
Envelope
Builds
Envelope instances. Not thread safe; use one builder per envelope.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattempt(int attempt) build()causationId(@Nullable String causationId) correlationId(@Nullable String correlationId) Adds one application header.replayCount(int replayCount) replayedAt(@Nullable Instant replayedAt) replayedFrom(@Nullable String replayedFrom) route(@Nullable RoutingSlip route) version(int version)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
- Parameters:
id- message identifier; a random UUID is generated when left unset
-
type
- Parameters:
type- logical message type; required
-
version
- Parameters:
version- payload schema version, at least 1; defaults to 1
-
correlationId
- Parameters:
correlationId- flow identifier; defaults to the message identifier
-
causationId
- Parameters:
causationId- identifier of the message that caused this one
-
attempt
- Parameters:
attempt- delivery attempt, at least 1; defaults to 1
-
firstSeen
- Parameters:
firstSeen- first publish time; defaults to now
-
origin
- Parameters:
origin- publishing process, conventionallyservice@host
-
error
- Parameters:
error- why the message was dead-lettered or parked
-
claim
- Parameters:
claim- where the payload is, when the application stores it outside the message. Absent rather than empty:nulland""both mean no claim, and neither puts a header on the wire
-
replayedFrom
- Parameters:
replayedFrom- queue this message was replayed out of
-
replayedAt
- Parameters:
replayedAt- when it was replayed
-
replayCount
- Parameters:
replayCount- how many times it has been replayed; must not be negative
-
route
- Parameters:
route- where the message is going, when it is travelling a pipeline- Returns:
- this builder
-
header
Adds one application header.- Parameters:
name- header name; must not use the AceMQ prefixvalue- header value- Returns:
- this builder
- Throws:
IllegalArgumentException- if the name is AceMQ-owned
-
headers
- Parameters:
headers- application headers to add; AceMQ-owned names are ignored
-
build
- Returns:
- the built envelope
- Throws:
NullPointerException- if no type was setIllegalArgumentException- if the version or attempt is below 1
-