MessageEnvelope constructor
Creates a new MessageEnvelope, which adds a correlation id, message id, and a type to the data being sent/received.
correlationId
(optional) transaction id to trace execution through call chain.messageType
a string value that defines the message's type.message
the data being sent/received.
Implementation
MessageEnvelope(String? correlationId, String? messageType, message)
: correlation_id = correlationId,
message_type = messageType,
message_id = IdGenerator.nextLong() {
if (message is Map || message is List) {
setMessageAsJson(message);
} else {
this.message = message;
}
}