Browse Source

Replace the AzureServiceBus example with the InMomory storage

master
Savorboard 5 years ago
parent
commit
96c13b87f2
8 changed files with 15 additions and 19 deletions
  1. +7
    -7
      CAP.sln
  2. +1
    -1
      samples/Sample.AzureServiceBus.InMemory/Controllers/ValuesController.cs
  3. +1
    -1
      samples/Sample.AzureServiceBus.InMemory/Program.cs
  4. +0
    -1
      samples/Sample.AzureServiceBus.InMemory/Sample.AzureServiceBus.InMemory.csproj
  5. +1
    -1
      samples/Sample.AzureServiceBus.InMemory/Startup.cs
  6. +0
    -0
      samples/Sample.AzureServiceBus.InMemory/appsettings.json
  7. +0
    -1
      samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj
  8. +5
    -7
      src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs

+ 7
- 7
CAP.sln View File

@@ -64,10 +64,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.MySql", "sampl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.AzureServiceBus", "src\DotNetCore.CAP.AzureServiceBus\DotNetCore.CAP.AzureServiceBus.csproj", "{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AzureServiceBus.MySql", "samples\Sample.AzureServiceBus.MySql\Sample.AzureServiceBus.MySql.csproj", "{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.InMemoryStorage", "src\DotNetCore.CAP.InMemoryStorage\DotNetCore.CAP.InMemoryStorage.csproj", "{58B6E829-C6C8-457C-9DD0-C600650254DF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AzureServiceBus.InMemory", "samples\Sample.AzureServiceBus.InMemory\Sample.AzureServiceBus.InMemory.csproj", "{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -134,14 +134,14 @@ Global
{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Release|Any CPU.Build.0 = Release|Any CPU
{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Release|Any CPU.Build.0 = Release|Any CPU
{58B6E829-C6C8-457C-9DD0-C600650254DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58B6E829-C6C8-457C-9DD0-C600650254DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58B6E829-C6C8-457C-9DD0-C600650254DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58B6E829-C6C8-457C-9DD0-C600650254DF}.Release|Any CPU.Build.0 = Release|Any CPU
{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -163,8 +163,8 @@ Global
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{11563D1A-27CC-45CF-8C04-C16BCC21250A} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{63B2A464-FBEA-42FB-8EFA-98AFA39FC920} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{58B6E829-C6C8-457C-9DD0-C600650254DF} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8} = {3A6B6931-A123-477A-9469-8B468B5385AF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E70565D-94CF-40B4-BFE1-AC18D5F736AB}


samples/Sample.AzureServiceBus.MySql/Controllers/ValuesController.cs → samples/Sample.AzureServiceBus.InMemory/Controllers/ValuesController.cs View File

@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;

namespace Sample.AzureServiceBus.MySql.Controllers
namespace Sample.AzureServiceBus.InMemory.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller, ICapSubscribe

samples/Sample.AzureServiceBus.MySql/Program.cs → samples/Sample.AzureServiceBus.InMemory/Program.cs View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace Sample.AzureServiceBus.MySql
namespace Sample.AzureServiceBus.InMemory
{
public class Program
{

samples/Sample.AzureServiceBus.MySql/Sample.AzureServiceBus.MySql.csproj → samples/Sample.AzureServiceBus.InMemory/Sample.AzureServiceBus.InMemory.csproj View File

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

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Sample.Kafka.MySql</AssemblyName>
<WarningsAsErrors>NU1701</WarningsAsErrors>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>

samples/Sample.AzureServiceBus.MySql/Startup.cs → samples/Sample.AzureServiceBus.InMemory/Startup.cs View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Sample.AzureServiceBus.MySql
namespace Sample.AzureServiceBus.InMemory
{
public class Startup
{

samples/Sample.AzureServiceBus.MySql/appsettings.json → samples/Sample.AzureServiceBus.InMemory/appsettings.json View File


+ 0
- 1
samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj View File

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

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Sample.Kafka.MySql</AssemblyName>
<WarningsAsErrors>NU1701</WarningsAsErrors>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>


+ 5
- 7
src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs View File

@@ -13,16 +13,16 @@ namespace DotNetCore.CAP.InMemoryStorage
{
internal class InMemoryMonitoringApi : IMonitoringApi
{
private readonly InMemoryStorage _storage;
private readonly IStorage _storage;

public InMemoryMonitoringApi(IStorage storage)
{
_storage = storage as InMemoryStorage ?? throw new ArgumentNullException(nameof(storage));
_storage = storage;
}

public StatisticsDto GetStatistics()
{
var connection = (InMemoryStorageConnection)_storage.GetConnection();
var connection = GetConnection();
var stats = new StatisticsDto
{
PublishedSucceeded = connection.PublishedMessages.Count(x => x.StatusName == StatusName.Succeeded),
@@ -62,8 +62,7 @@ namespace DotNetCore.CAP.InMemoryStorage

if (!string.IsNullOrEmpty(queryDto.Content))
{
//TODO: StartsWith will replace with regex
expression = expression.Where(x => x.Content.StartsWith(queryDto.Content));
expression = expression.Where(x => x.Content.Contains(queryDto.Content));
}

var offset = queryDto.CurrentPage * queryDto.PageSize;
@@ -101,8 +100,7 @@ namespace DotNetCore.CAP.InMemoryStorage

if (!string.IsNullOrEmpty(queryDto.Content))
{
//TODO: StartsWith will replace with regex
expression = expression.Where(x => x.Content.StartsWith(queryDto.Content));
expression = expression.Where(x => x.Content.Contains(queryDto.Content));
}

var offset = queryDto.CurrentPage * queryDto.PageSize;


Loading…
Cancel
Save