Procházet zdrojové kódy

Modify the data structure, do not inherit the MessageBase.

master
Savorboard před 7 roky
rodič
revize
dffa03c3af
4 změnil soubory, kde provedl 94 přidání a 55 odebrání
  1. +0
    -49
      src/DotNetCore.CAP/Infrastructure/CapMessage.cs
  2. +42
    -4
      src/DotNetCore.CAP/Infrastructure/CapReceivedMessage.cs
  3. +35
    -2
      src/DotNetCore.CAP/Infrastructure/CapSentMessage.cs
  4. +17
    -0
      src/DotNetCore.CAP/Infrastructure/StatusName.cs

+ 0
- 49
src/DotNetCore.CAP/Infrastructure/CapMessage.cs Zobrazit soubor

@@ -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);
}
}

+ 42
- 4
src/DotNetCore.CAP/Infrastructure/CapReceivedMessage.cs Zobrazit soubor

@@ -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
};
}
}
}

+ 35
- 2
src/DotNetCore.CAP/Infrastructure/CapSentMessage.cs Zobrazit soubor

@@ -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; }
}
}

+ 17
- 0
src/DotNetCore.CAP/Infrastructure/StatusName.cs Zobrazit soubor

@@ -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);
}
}

Načítá se…
Zrušit
Uložit