private SerializedMessage(SerializedMessage<T> message, Map<String, ?> metaData) { this.identifier = message.getIdentifier(); this.serializedMetaData = new LazyDeserializingObject<>(MetaData.from(metaData)); this.serializedPayload = message.serializedPayload; }
/** * Initialize a DomainEventMessage originating from an Aggregate with the given <code> * aggregateIdentifier</code>, with given <code>sequenceNumber</code> and <code>payload</code>. * The MetaData of the message is empty. * * @param aggregateIdentifier The identifier of the aggregate generating this message * @param sequenceNumber The message's sequence number * @param payload The application-specific payload of the message */ public GenericDomainEventMessage(String aggregateIdentifier, long sequenceNumber, T payload) { this(aggregateIdentifier, sequenceNumber, payload, MetaData.emptyInstance()); }
@Override public MetaData getMetaData() { MetaData metaData = serializedMetaData.getObject(); return metaData == null ? MetaData.emptyInstance() : metaData; }