Skip to content

Commit

Permalink
Merge pull request #98 from argon-chat/feature/broadcast-and-messagepack
Browse files Browse the repository at this point in the history
Broadcast, messagepack improvements, and other
  • Loading branch information
urumo authored Dec 4, 2024
2 parents a2c571b + d8d713b commit f370bbb
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 29 deletions.
32 changes: 32 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides =
ij_wrap_on_typing = false
csharp_indent_labels = no_change
csharp_using_directive_placement = inside_namespace:warning
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

[*.{csproj}]
charset = utf-8-bom
Expand Down Expand Up @@ -379,3 +396,18 @@ indent_style = space
indent_style = space
indent_size = 4
tab_width = 4
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
4 changes: 2 additions & 2 deletions Argon.Server.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
.gitmodules = .gitmodules
GitVersion.yml = GitVersion.yml
src\AppHost\aspirate-output\docker-compose.yaml = src\AppHost\aspirate-output\docker-compose.yaml
GitVersion.yml = GitVersion.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Contracts", "src\Argon.Contracts\Argon.Contracts.csproj", "{151002BD-57E5-440B-9CA7-C681A69CA02C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Shared", "src\Argon.Contracts\Argon.Shared.csproj", "{151002BD-57E5-440B-9CA7-C681A69CA02C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{90798FD4-3C62-4AE1-ADE9-F5EC4A0FD4B1}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ merge-message-formats: { }
commit-message-incrementing: Enabled
patch-version-bump-message: "^(add|bump|drop|mv|move|update|expose|remove|refactoring|additional|use|improvement|fix|refactor)(.+)?"
tag-prefix: 'IGNORE'
next-version: "0.1"
next-version: "0.3"
21 changes: 13 additions & 8 deletions src/Argon.Api/Features/Orleanse/OrleansExtension.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
namespace Argon.Api.Features;
namespace Argon.Features;

using ActualLab.Serialization;
using Argon.Api.Features.Sentry;
using Contracts;
using Env;
using Extensions;
using Grains.Interfaces;
using MessagePack.Resolvers;
using Orleans.Clustering.Kubernetes;
using Orleans.Configuration;
using Orleans.Serialization;
using OrleansStreamingProviders;
using Sentry;

#pragma warning disable ORLEANSEXP001

public static class OrleansExtension
{
public static WebApplicationBuilder AddOrleans(this WebApplicationBuilder builder)
{
builder.Services.AddSerializer(x => x.AddMessagePackSerializer(null, null, MessagePackByteSerializer.Default.Options));
var options = MessagePackSerializerOptions.Standard
.WithResolver(CompositeResolver.Create(
DynamicEnumAsStringResolver.Instance,
StandardResolver.Instance));
MessagePackSerializer.DefaultOptions = options;
builder.Services.AddSerializer(x => x.AddMessagePackSerializer(null, null, MessagePackSerializer.DefaultOptions));
builder.Host.UseOrleans(siloBuilder =>
{
siloBuilder.Configure<ClusterOptions>(builder.Configuration.GetSection("Orleans"))
Expand All @@ -42,15 +45,17 @@ public static WebApplicationBuilder AddOrleans(this WebApplicationBuilder builde
.AddActivationRepartitioner<BalanceRule>()
.AddRedisStorage(IFusionSessionGrain.StorageId, 2)
.AddPersistentStreams("default", NatsAdapterFactory.Create, options => { })
.AddPersistentStreams(IArgonEvent.ProviderId, NatsAdapterFactory.Create, options => { });
.AddPersistentStreams(IArgonEvent.ProviderId, NatsAdapterFactory.Create, options => { })
.AddBroadcastChannel(IArgonEvent.Broadcast);
}
else
{
siloBuilder
.UseLocalhostClustering()
.AddMemoryStreams("default")
.AddMemoryStreams(IArgonEvent.ProviderId)
.AddMemoryGrainStorage(IFusionSessionGrain.StorageId);
.AddMemoryGrainStorage(IFusionSessionGrain.StorageId)
.AddBroadcastChannel(IArgonEvent.Broadcast);
}
});

Expand Down
1 change: 0 additions & 1 deletion src/Argon.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
builder.AddEfRepositories();
builder.AddKubeResources();
builder.AddCaptchaFeature();
builder.Services.AddSignalR();
builder.Services.AddDataProtection();
var app = builder.Build();

Expand Down
17 changes: 0 additions & 17 deletions src/Argon.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64259",
"sslPort": 44394
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5100",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down

0 comments on commit f370bbb

Please sign in to comment.