Commit dffa03c3 authored by Savorboard's avatar Savorboard

Modify the data structure, do not inherit the MessageBase.

parent 73baaa84
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
};
}
}
}
\ No newline at end of file
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; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
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>
......@@ -46,4 +14,4 @@ namespace DotNetCore.CAP.Infrastructure
public const string Succeeded = nameof(Succeeded);
public const string Failed = nameof(Failed);
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment