Example #1
0
 /// <summary>
 /// Initialize a DomainEventMessage originating from an Aggregate using existing data.
 /// </summary>
 /// <param name="type">The domain type</param>
 /// <param name="aggregateIdentifier">The identifier of the aggregate generating this message</param>
 /// <param name="sequenceNumber">The message's sequence number</param>
 /// <param name="payload">The application-specific payload of the message</param>
 /// <param name="metaData">The MetaData to attach to the message</param>
 /// <param name="messageIdentifier">The message identifier</param>
 /// <param name="timestamp">The event's timestamp</param>
 public GenericDomainEventMessage(string type, string aggregateIdentifier, long sequenceNumber, T payload,
                                  IImmutableDictionary <string, object> metaData, string messageIdentifier,
                                  InternalDateTimeOffset timestamp)
     : this(type, aggregateIdentifier, sequenceNumber,
            new GenericMessage <T>(messageIdentifier, payload, metaData),
            timestamp)
 {
 }
 /// <summary>
 /// Returns the given {@code deadlineName} and {@code messageOrPayload} as a DeadlineMessage which expires at the
 /// given {@code expiryTime}. If the {@code messageOrPayload} parameter is of type {@link Message}, a new
 /// {@code DeadlineMessage} instance will be created using the payload and meta data of the given message.
 /// Otherwise, the given {@code messageOrPayload} is wrapped into a {@code GenericDeadlineMessage} as its payload.
 /// </summary>
 /// <param name="deadlineName">A {@link String} denoting the deadline's name</param>
 /// <param name="messageOrPayload">A {@link Message} or payload to wrap as a DeadlineMessage</param>
 /// <param name="expiryTime">The timestamp at which the deadline expires</param>
 /// <typeparam name="T">The generic type of the expected payload of the resulting object</typeparam>
 /// <returns>a DeadlineMessage using the {@code deadlineName} as its deadline name and containing the given
 /// {@code messageOrPayload} as the payload</returns>
 public static IDeadlineMessage <T> AsDeadlineMessage(string deadlineName,
                                                      object messageOrPayload,
                                                      InternalDateTimeOffset expiryTime)
 {
     return(messageOrPayload is IMessage <T> message
         ? new GenericDeadlineMessage <T>(deadlineName, message,
                                          CachingSupplier <InternalDateTimeOffset> .Of(() => expiryTime))
         : new GenericDeadlineMessage <T>(deadlineName, new GenericMessage <T>((T)messageOrPayload),
                                          CachingSupplier <InternalDateTimeOffset> .Of(() => expiryTime)));
 }
 public GenericEventMessage(string identifier, T payload, IImmutableDictionary <string, object> metaData,
                            InternalDateTimeOffset timestamp) :
     this(new GenericMessage <T>(identifier, payload, metaData), timestamp)
 {
 }
Example #4
0
 public static string FormatInstant(InternalDateTimeOffset instant)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// Constructor to reconstructs a DeadlineMessage using existing data.
 /// </summary>
 /// <param name="deadlineName">A {@link String} denoting the deadline's name</param>
 /// <param name="identifier">The identifier of type {@link String} for the Message</param>
 /// <param name="payload">The payload of type {@code T} for the Message</param>
 /// <param name="metaData">The {@link MetaData} of the Message</param>
 /// <param name="timestamp">An {@link Instant} timestamp of the Message creation</param>
 public GenericDeadlineMessage(string deadlineName, string identifier, T payload,
                               IImmutableDictionary <string, object> metaData, InternalDateTimeOffset timestamp) : base(identifier, payload,
                                                                                                                        metaData, timestamp)
 {
     _deadlineName = deadlineName;
 }