Skip to content

Commit

Permalink
added ConfirmableMessage<T> (petabridge#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored May 9, 2019
1 parent 2677f9e commit 053fe6c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Akka.Persistence.Extras/ConfirmableMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ public ConfirmableMessageEnvelope(long confirmationId, string senderId, object m
public string SenderId { get; }
}

/// <summary>
/// A built-in envelope for making user-defined messages <see cref="IConfirmableMessage" />
/// without changing the types of the messages themselves.
///
/// Designed to play nicely with typed Receive statements inside actors.
/// </summary>
public sealed class ConfirmableMessage<TMessage> : IConfirmableMessage
{
public ConfirmableMessage(TMessage message, long confirmationId, string senderId)
{
Message = message;
ConfirmationId = confirmationId;
SenderId = senderId;
}

/// <summary>
/// The user-defined message.
/// </summary>
public TMessage Message { get; }

/// <inheritdoc />
public long ConfirmationId { get; }

/// <inheritdoc />
public string SenderId { get; }
}

/// <summary>
/// Used to persist the handling of a <see cref="IConfirmableMessage" />
/// </summary>
Expand Down

0 comments on commit 053fe6c

Please sign in to comment.