Add project files.
This commit is contained in:
parent
d7758ae9b5
commit
7b0c7e7f57
20
Client/Client.csproj
Normal file
20
Client/Client.csproj
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Orleans.Client" Version="8.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.Orleans.Streaming" Version="8.1.0" />
|
||||||
|
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Provider\Provider.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
2
Client/Program.cs
Normal file
2
Client/Program.cs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
Console.WriteLine("Hello, World!");
|
||||||
14
Provider/Provider.csproj
Normal file
14
Provider/Provider.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Orleans.Streaming" Version="8.1.0" />
|
||||||
|
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
12
Provider/RedisStreamAdapter.cs
Normal file
12
Provider/RedisStreamAdapter.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Provider
|
||||||
|
{
|
||||||
|
internal class RedisStreamAdapter
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Provider/RedisStreamBatchContainer.cs
Normal file
27
Provider/RedisStreamBatchContainer.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Orleans.Runtime;
|
||||||
|
using Orleans.Streams;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Provider
|
||||||
|
{
|
||||||
|
public class RedisStreamBatchContainer : IBatchContainer
|
||||||
|
{
|
||||||
|
public StreamId StreamId => throw new NotImplementedException();
|
||||||
|
private rea
|
||||||
|
public StreamSequenceToken SequenceToken => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IEnumerable<Tuple<T, StreamSequenceToken>> GetEvents<T>()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ImportRequestContext()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Provider/RedisStreamFactory.cs
Normal file
7
Provider/RedisStreamFactory.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Provider
|
||||||
|
{
|
||||||
|
public class RedisStreamFactory
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Provider/RedisStreamFailureHandler.cs
Normal file
36
Provider/RedisStreamFailureHandler.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Orleans.Runtime;
|
||||||
|
using Orleans.Streams;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Provider
|
||||||
|
{
|
||||||
|
public class RedisStreamFailureHandler : IStreamFailureHandler
|
||||||
|
{
|
||||||
|
private ILogger<RedisStreamFailureHandler> _logger;
|
||||||
|
|
||||||
|
public RedisStreamFailureHandler(ILogger<RedisStreamFailureHandler> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShouldFaultSubsriptionOnError => true;
|
||||||
|
|
||||||
|
|
||||||
|
public Task OnDeliveryFailure(GuidId subscriptionId, string streamProviderName, StreamId streamIdentity, StreamSequenceToken sequenceToken)
|
||||||
|
{
|
||||||
|
_logger.LogError("Delivery failure for subscription {SubscriptionId} on stream {StreamId} with token {Token}", subscriptionId, streamIdentity, sequenceToken);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task OnSubscriptionFailure(GuidId subscriptionId, string streamProviderName, StreamId streamIdentity, StreamSequenceToken sequenceToken)
|
||||||
|
{
|
||||||
|
_logger.LogError("Subscription failure for subscription {SubscriptionId} on stream {StreamId} with token {Token}", subscriptionId, streamIdentity, sequenceToken);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Provider/RedisStreamSequenceToken.cs
Normal file
29
Provider/RedisStreamSequenceToken.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using Orleans;
|
||||||
|
using Orleans.Streams;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Provider
|
||||||
|
{
|
||||||
|
[GenerateSerializer]
|
||||||
|
internal class RedisStreamSequenceToken : StreamSequenceToken
|
||||||
|
{
|
||||||
|
[Id(0)]
|
||||||
|
public override long SequenceNumber { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
|
||||||
|
[Id(1)]
|
||||||
|
public override int EventIndex { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
|
||||||
|
|
||||||
|
public override int CompareTo(StreamSequenceToken other)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(StreamSequenceToken other)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
RedisStreamsInOrleans.sln
Normal file
37
RedisStreamsInOrleans.sln
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.10.34928.147
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{35E441B1-DDF7-4497-B1D9-BBD9248690E9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{B7477618-DE9C-4586-98D2-46CFF1CB0C74}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Provider", "Provider\Provider.csproj", "{70F8E685-F662-4225-A60C-D318E0C6ED18}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{35E441B1-DDF7-4497-B1D9-BBD9248690E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B7477618-DE9C-4586-98D2-46CFF1CB0C74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7477618-DE9C-4586-98D2-46CFF1CB0C74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B7477618-DE9C-4586-98D2-46CFF1CB0C74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B7477618-DE9C-4586-98D2-46CFF1CB0C74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{70F8E685-F662-4225-A60C-D318E0C6ED18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{70F8E685-F662-4225-A60C-D318E0C6ED18}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{70F8E685-F662-4225-A60C-D318E0C6ED18}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{70F8E685-F662-4225-A60C-D318E0C6ED18}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {9A8081FD-99C7-4302-A892-DC1DE30F4853}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
23
Server/Program.cs
Normal file
23
Server/Program.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using StackExchange.Redis;
|
||||||
|
|
||||||
|
var builder = new HostBuilder()
|
||||||
|
.UseOrleans(silo =>
|
||||||
|
{
|
||||||
|
silo.UseLocalhostClustering();
|
||||||
|
silo.Services.AddSingleton<IDatabase>(sp =>
|
||||||
|
{
|
||||||
|
return ConnectionMultiplexer.Connect("localhost").GetDatabase();
|
||||||
|
});
|
||||||
|
silo.ConfigureLogging(logging => logging.AddConsole());
|
||||||
|
silo.AddMemoryGrainStorage("PubSubStore");
|
||||||
|
|
||||||
|
silo.AddMemoryGrainStorageAsDefault();
|
||||||
|
}).UseConsoleLifetime();
|
||||||
|
|
||||||
|
using IHost host = builder.Build();
|
||||||
|
await host.RunAsync();
|
||||||
20
Server/Server.csproj
Normal file
20
Server/Server.csproj
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Orleans.Server" Version="8.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.Orleans.Streaming" Version="8.1.0" />
|
||||||
|
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Provider\Provider.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Loading…
x
Reference in New Issue
Block a user