Class TypedMessage
-
- All Implemented Interfaces:
public final class TypedMessage<T extends Object>A decoded payload with the envelope it arrived in.
What eu.vstoyanov.natsy.subscribe hands over is the payload alone, which is all most subscribers want. The three things it leaves behind are needed often enough to be worth a type: subject is the only way a wildcard subscriber learns which subject matched, replyTo is what makes answering a request possible, and headers carry whatever the publisher put beside the payload - a trace id, a tenant, a schema version.
eu.vstoyanov.natsy.subscribeMessages is the same subscription carrying these instead, and eu.vstoyanov.natsy.respond is written on top of it.
-
-
Constructor Summary
Constructors Constructor Description TypedMessage(T payload, String subject, String replyTo, Headers headers)
-
Method Summary
Modifier and Type Method Description final TgetPayload()the decoded message final StringgetSubject()the subject this message was published to, which for a wildcard or queue subscription is not the subject that was subscribed to final StringgetReplyTo()the subject a reply is expected on, or nullfor a message that is not a requestfinal HeadersgetHeaders()the headers the message arrived with, or nullif it carried none-
-
Method Detail
-
getPayload
final T getPayload()
the decoded message
-
getSubject
final String getSubject()
the subject this message was published to, which for a wildcard or queue subscription is not the subject that was subscribed to
-
getReplyTo
final String getReplyTo()
the subject a reply is expected on, or
nullfor a message that is not a request
-
getHeaders
final Headers getHeaders()
the headers the message arrived with, or
nullif it carried none
-
-
-
-