@@ -1,49 +0,0 @@ | |||
using System; | |||
namespace DotNetCore.CAP.Infrastructure | |||
{ | |||
/// <summary> | |||
/// cap messages store model. | |||
/// </summary> | |||
public abstract class CapMessage : MessageBase | |||
{ | |||
/// <summary> | |||
/// Initializes a new instance of <see cref="CapMessage"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// The Id property is initialized to from a new GUID string value. | |||
/// </remarks> | |||
protected CapMessage() | |||
{ | |||
Id = Guid.NewGuid().ToString(); | |||
Added = DateTime.Now; | |||
} | |||
protected CapMessage(MessageBase message) | |||
{ | |||
KeyName = message.KeyName; | |||
Content = message.Content; | |||
} | |||
public string Id { get; set; } | |||
public DateTime Added { get; set; } | |||
public DateTime LastRun { get; set; } | |||
public int Retries { get; set; } | |||
public string StatusName { get; set; } | |||
} | |||
/// <summary> | |||
/// The message status name. | |||
/// </summary> | |||
public struct StatusName | |||
{ | |||
public const string Enqueued = nameof(Enqueued); | |||
public const string Processing = nameof(Processing); | |||
public const string Succeeded = nameof(Succeeded); | |||
public const string Failed = nameof(Failed); | |||
} | |||
} |
@@ -1,14 +1,52 @@ | |||
namespace DotNetCore.CAP.Infrastructure | |||
using System; | |||
namespace DotNetCore.CAP.Infrastructure | |||
{ | |||
public class CapReceivedMessage : CapMessage | |||
public class CapReceivedMessage | |||
{ | |||
/// <summary> | |||
/// Initializes a new instance of <see cref="CapReceivedMessage"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// The Id property is initialized to from a new GUID string value. | |||
/// </remarks> | |||
public CapReceivedMessage() | |||
{ | |||
Id = Guid.NewGuid().ToString(); | |||
Added = DateTime.Now; | |||
} | |||
public CapReceivedMessage(MessageContext message) : this() | |||
{ | |||
Group = message.Group; | |||
KeyName = message.KeyName; | |||
Content = message.Content; | |||
} | |||
public CapReceivedMessage(MessageBase baseMessage) | |||
: base(baseMessage) | |||
public string Id { get; set; } | |||
public string Group { get; set; } | |||
public string KeyName { get; set; } | |||
public string Content { get; set; } | |||
public DateTime Added { get; set; } | |||
public DateTime LastRun { get; set; } | |||
public int Retries { get; set; } | |||
public string StatusName { get; set; } | |||
public MessageContext ToMessageContext() | |||
{ | |||
return new MessageContext | |||
{ | |||
Group = Group, | |||
KeyName = KeyName, | |||
Content = Content | |||
}; | |||
} | |||
} | |||
} |
@@ -1,6 +1,39 @@ | |||
namespace DotNetCore.CAP.Infrastructure | |||
using System; | |||
namespace DotNetCore.CAP.Infrastructure | |||
{ | |||
public class CapSentMessage : CapMessage | |||
public class CapSentMessage | |||
{ | |||
/// <summary> | |||
/// Initializes a new instance of <see cref="CapSentMessage"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// The Id property is initialized to from a new GUID string value. | |||
/// </remarks> | |||
public CapSentMessage() | |||
{ | |||
Id = Guid.NewGuid().ToString(); | |||
Added = DateTime.Now; | |||
} | |||
public CapSentMessage(MessageContext message) | |||
{ | |||
KeyName = message.KeyName; | |||
Content = message.Content; | |||
} | |||
public string Id { get; set; } | |||
public string KeyName { get; set; } | |||
public string Content { get; set; } | |||
public DateTime Added { get; set; } | |||
public DateTime LastRun { get; set; } | |||
public int Retries { get; set; } | |||
public string StatusName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace DotNetCore.CAP.Infrastructure | |||
{ | |||
/// <summary> | |||
/// The message status name. | |||
/// </summary> | |||
public struct StatusName | |||
{ | |||
public const string Enqueued = nameof(Enqueued); | |||
public const string Processing = nameof(Processing); | |||
public const string Succeeded = nameof(Succeeded); | |||
public const string Failed = nameof(Failed); | |||
} | |||
} |