Browse Source

Enable #nullable for inmemory storage.

master
Savorboard 3 years ago
parent
commit
85a66f5b77
4 changed files with 12 additions and 13 deletions
  1. +1
    -1
      src/DotNetCore.CAP.InMemoryStorage/DotNetCore.CAP.InMemoryStorage.csproj
  2. +6
    -6
      src/DotNetCore.CAP.InMemoryStorage/IDataStorage.InMemory.cs
  3. +2
    -2
      src/DotNetCore.CAP.InMemoryStorage/MemoryMessage.cs
  4. +3
    -4
      src/DotNetCore.CAP/Transport/IConsumerClient.cs

+ 1
- 1
src/DotNetCore.CAP.InMemoryStorage/DotNetCore.CAP.InMemoryStorage.csproj View File

@@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>DotNetCore.CAP.InMemoryStorage</AssemblyName>
<Nullable>enable</Nullable>
<PackageTags>$(PackageTags);InMemory</PackageTags>
</PropertyGroup>



+ 6
- 6
src/DotNetCore.CAP.InMemoryStorage/IDataStorage.InMemory.cs View File

@@ -26,9 +26,9 @@ namespace DotNetCore.CAP.InMemoryStorage
_serializer = serializer;
}

public static Dictionary<string, MemoryMessage> PublishedMessages { get; } = new Dictionary<string, MemoryMessage>();
public static Dictionary<string, MemoryMessage> PublishedMessages { get; } = new();

public static Dictionary<string, MemoryMessage> ReceivedMessages { get; } = new Dictionary<string, MemoryMessage>();
public static Dictionary<string, MemoryMessage> ReceivedMessages { get; } = new();

public Task ChangePublishStateAsync(MediumMessage message, StatusName state)
{
@@ -46,7 +46,7 @@ namespace DotNetCore.CAP.InMemoryStorage
return Task.CompletedTask;
}

public MediumMessage StoreMessage(string name, Message content, object dbTransaction = null)
public MediumMessage StoreMessage(string name, Message content, object? dbTransaction = null)
{
var message = new MediumMessage
{
@@ -85,7 +85,7 @@ namespace DotNetCore.CAP.InMemoryStorage
{
DbId = id,
Group = group,
Origin = null,
Origin = null!,
Name = name,
Content = content,
Retries = _capOptions.Value.FailedRetryCount,
@@ -186,7 +186,7 @@ namespace DotNetCore.CAP.InMemoryStorage

foreach (var message in result)
{
message.Origin = _serializer.Deserialize(message.Content);
message.Origin = _serializer.Deserialize(message.Content)!;
}

return Task.FromResult(result);
@@ -208,7 +208,7 @@ namespace DotNetCore.CAP.InMemoryStorage

foreach (var message in result)
{
message.Origin = _serializer.Deserialize(message.Content);
message.Origin = _serializer.Deserialize(message.Content)!;
}

return Task.FromResult(result);


+ 2
- 2
src/DotNetCore.CAP.InMemoryStorage/MemoryMessage.cs View File

@@ -8,10 +8,10 @@ namespace DotNetCore.CAP.InMemoryStorage
{
internal class MemoryMessage : MediumMessage
{
public string Name { get; set; }
public string Name { get; set; } = default!;

public StatusName StatusName { get; set; }

public string Group { get; set; }
public string Group { get; set; } = default!;
}
}

+ 3
- 4
src/DotNetCore.CAP/Transport/IConsumerClient.cs View File

@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using DotNetCore.CAP.Messages;
using JetBrains.Annotations;

namespace DotNetCore.CAP.Transport
{
@@ -23,7 +22,7 @@ namespace DotNetCore.CAP.Transport
/// </summary>
/// <param name="topicNames">Names of the requested topics</param>
/// <returns>Topic identifiers</returns>
ICollection<string> FetchTopics([NotNull] IEnumerable<string> topicNames)
ICollection<string> FetchTopics(IEnumerable<string> topicNames)
{
return topicNames.ToList();
}
@@ -32,7 +31,7 @@ namespace DotNetCore.CAP.Transport
/// Subscribe to a set of topics to the message queue
/// </summary>
/// <param name="topics"></param>
void Subscribe([NotNull] IEnumerable<string> topics);
void Subscribe(IEnumerable<string> topics);

/// <summary>
/// Start listening
@@ -42,7 +41,7 @@ namespace DotNetCore.CAP.Transport
/// <summary>
/// Manual submit message offset when the message consumption is complete
/// </summary>
void Commit([NotNull] object sender);
void Commit(object sender);

/// <summary>
/// Reject message and resumption


Loading…
Cancel
Save