From 84f51ac59c1027dc558d82c8f1c375dfce6d2fd2 Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Fri, 16 Feb 2024 22:32:41 +0000 Subject: [PATCH 01/18] Initial work to get Native AOT working --- Directory.Packages.props | 1 + .../ApplicationJsonContext.cs | 11 + ...aying.Sample.Restaurant.OrderingApi.csproj | 4 + .../JustSayingHostedService.cs | 18 + .../OrderingApi.http | 11 + .../Program.cs | 8 + .../IServiceCollectionExtensions.cs | 9 + ...sions.DependencyInjection.Microsoft.csproj | 5 +- .../PublicAPI/net8.0/PublicAPI.Shipped.txt | 8 + .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 0 .../JustSaying.Models.csproj | 2 +- .../PublicAPI/net8.0/PublicAPI.Shipped.txt | 15 + .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 0 .../MessageHandling/PublishException.cs | 4 +- .../MessageHandling/SnsPolicyBuilder.cs | 12 +- .../ConfigurationErrorsException.cs | 4 +- src/JustSaying/Constants.cs | 7 + .../JsonSerializerOptionsExtensions.cs | 21 + .../ServiceResolver/DefaultServiceResolver.cs | 18 +- ...dlerNotRegisteredWithContainerException.cs | 2 + src/JustSaying/JustSaying.csproj | 8 +- .../JustSayingSerializationContext.cs | 9 + .../MessageFormatNotSupportedException.cs | 4 +- .../NewtonsoftSerializationFactory.cs | 4 + .../NewtonsoftSerializer.cs | 4 + .../SqsMessageEnvelope.cs | 8 + .../SystemTextJsonSerializationFactory.cs | 4 + .../SystemTextJsonSerializer.cs | 12 +- .../SystemTextJsonSerializer`1.cs | 119 +++ ...TypedSystemTextJsonSerializationFactory.cs | 11 + .../PublicAPI/net8.0/PublicAPI.Shipped.txt | 745 ++++++++++++++++++ .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 10 + 32 files changed, 1088 insertions(+), 10 deletions(-) create mode 100644 samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs create mode 100644 samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs create mode 100644 samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http create mode 100644 src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Shipped.txt create mode 100644 src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Unshipped.txt create mode 100644 src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Shipped.txt create mode 100644 src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Unshipped.txt create mode 100644 src/JustSaying/Constants.cs create mode 100644 src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs create mode 100644 src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs create mode 100644 src/JustSaying/Messaging/MessageSerialization/SqsMessageEnvelope.cs create mode 100644 src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs create mode 100644 src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs create mode 100644 src/JustSaying/PublicAPI/net8.0/PublicAPI.Shipped.txt create mode 100644 src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt diff --git a/Directory.Packages.props b/Directory.Packages.props index 6f6956892..74e19cbd8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,6 +7,7 @@ + diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs new file mode 100644 index 000000000..26763525c --- /dev/null +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +using JustSaying.Sample.Restaurant.Models; +using JustSaying.Sample.Restaurant.OrderingApi.Models; + +namespace JustSaying.Sample.Restaurant.OrderingApi; + +[JsonSerializable(typeof(CustomerOrderModel))] +[JsonSerializable(typeof(OrderReadyEvent))] +[JsonSerializable(typeof(OrderDeliveredEvent))] +[JsonSerializable(typeof(OrderOnItsWayEvent))] +public sealed partial class ApplicationJsonContext : JsonSerializerContext; diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj index b0f51d843..773df8f61 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj @@ -24,4 +24,8 @@ + + true + + diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs new file mode 100644 index 000000000..ba7fd0329 --- /dev/null +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs @@ -0,0 +1,18 @@ +using JustSaying.Messaging; + +namespace JustSaying.Sample.Restaurant.OrderingApi; + +public sealed class JustSayingHostedService(IMessagingBus bus, IMessagePublisher publisher) : BackgroundService +{ + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + try + { + await Task.WhenAll(publisher.StartAsync(stoppingToken), bus.StartAsync(stoppingToken)); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } +} diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http new file mode 100644 index 000000000..a5d907730 --- /dev/null +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http @@ -0,0 +1,11 @@ +@HostAddress = https://localhost:5001 + +POST {{HostAddress}}/api/orders +Content-Type: application/json +Accept: application/json + +{ + "description": "A cool description" +} + +### diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index c755c2b1a..1eede8dff 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -1,8 +1,10 @@ +using System.Text.Json; using JustSaying.Messaging; using JustSaying.Sample.Restaurant.Models; using JustSaying.Sample.Restaurant.OrderingApi; using JustSaying.Sample.Restaurant.OrderingApi.Handlers; using JustSaying.Sample.Restaurant.OrderingApi.Models; +using Microsoft.Extensions.Options; using Microsoft.OpenApi.Models; using Serilog; using Serilog.Events; @@ -23,6 +25,12 @@ var builder = WebApplication.CreateBuilder(args); var configuration = builder.Configuration; builder.Host.UseSerilog(); + builder.Services.ConfigureHttpJsonOptions(cfg => + { + cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); + }); + builder.Services.AddHostedService(); + builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); builder.Services.AddJustSaying(config => { config.Client(x => diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index 47b6ebbc6..51f389500 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using JustSaying; using JustSaying.AwsTools; using JustSaying.AwsTools.QueueCreation; @@ -135,7 +136,11 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); +#if NET8_0_OR_GREATER + services.TryAddSingleton(); +#else services.TryAddSingleton(); +#endif services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton( @@ -199,7 +204,11 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, /// /// is . /// +#if NET8_0_OR_GREATER + public static IServiceCollection AddJustSayingHandler(this IServiceCollection services) +#else public static IServiceCollection AddJustSayingHandler(this IServiceCollection services) +#endif where TMessage : Message where THandler : class, IHandlerAsync { diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj b/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj index 10ba4fb56..21516d6d4 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj @@ -4,7 +4,7 @@ true true Microsoft.Extensions.DependencyInjection - netstandard2.0;net461 + netstandard2.0;net461;net8.0 @@ -15,4 +15,7 @@ + + true + diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Shipped.txt b/src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000..577664e6b --- /dev/null +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Shipped.txt @@ -0,0 +1,8 @@ +Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSaying(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSaying(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string region) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSaying(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSaying(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSayingHandler(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.AddJustSayingHandlers(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Collections.Generic.IEnumerable> handlers) -> Microsoft.Extensions.DependencyInjection.IServiceCollection +static Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions.ConfigureJustSaying(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying.Extensions.DependencyInjection.Microsoft/PublicAPI/net8.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..e69de29bb diff --git a/src/JustSaying.Models/JustSaying.Models.csproj b/src/JustSaying.Models/JustSaying.Models.csproj index 83c3ce769..2dfb50044 100644 --- a/src/JustSaying.Models/JustSaying.Models.csproj +++ b/src/JustSaying.Models/JustSaying.Models.csproj @@ -1,7 +1,7 @@ true - netstandard2.0;net461 + netstandard2.0;net461;net8.0 diff --git a/src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Shipped.txt b/src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000..3fbd4aa5c --- /dev/null +++ b/src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Shipped.txt @@ -0,0 +1,15 @@ +JustSaying.Models.Message +JustSaying.Models.Message.Conversation.get -> string +JustSaying.Models.Message.Conversation.set -> void +JustSaying.Models.Message.Id.get -> System.Guid +JustSaying.Models.Message.Id.set -> void +JustSaying.Models.Message.Message() -> void +JustSaying.Models.Message.RaisingComponent.get -> string +JustSaying.Models.Message.RaisingComponent.set -> void +JustSaying.Models.Message.SourceIp.get -> string +JustSaying.Models.Message.Tenant.get -> string +JustSaying.Models.Message.Tenant.set -> void +JustSaying.Models.Message.TimeStamp.get -> System.DateTime +JustSaying.Models.Message.TimeStamp.set -> void +JustSaying.Models.Message.Version.get -> string +virtual JustSaying.Models.Message.UniqueKey() -> string diff --git a/src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying.Models/PublicAPI/net8.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..e69de29bb diff --git a/src/JustSaying/AwsTools/MessageHandling/PublishException.cs b/src/JustSaying/AwsTools/MessageHandling/PublishException.cs index a5a054906..3a60d1cdd 100644 --- a/src/JustSaying/AwsTools/MessageHandling/PublishException.cs +++ b/src/JustSaying/AwsTools/MessageHandling/PublishException.cs @@ -17,7 +17,9 @@ public PublishException(string message, Exception inner) : base(message, inner) { } +#if !NET8_0_OR_GREATER protected PublishException(SerializationInfo info, StreamingContext context) : base(info, context) { } -} \ No newline at end of file +#endif +} diff --git a/src/JustSaying/AwsTools/MessageHandling/SnsPolicyBuilder.cs b/src/JustSaying/AwsTools/MessageHandling/SnsPolicyBuilder.cs index ddb200e57..9e72385ae 100644 --- a/src/JustSaying/AwsTools/MessageHandling/SnsPolicyBuilder.cs +++ b/src/JustSaying/AwsTools/MessageHandling/SnsPolicyBuilder.cs @@ -1,5 +1,6 @@ using System.Text.Json; using Amazon; +using JustSaying.Messaging.MessageSerialization; namespace JustSaying.AwsTools.MessageHandling; @@ -41,7 +42,7 @@ internal static string BuildPolicyJson(SnsPolicyDetails policyDetails) ""Sid"" : ""{Guid.NewGuid().ToString().Replace("-", "")}"", ""Effect"" : ""Allow"", ""Principal"" : {{ - ""AWS"" : {JsonSerializer.Serialize(policyDetails.AccountIds)} + ""AWS"" : {SerializeAccountIds(policyDetails.AccountIds)} }}, ""Action"" : ""sns:Subscribe"", ""Resource"" : ""{policyDetails.SourceArn}"" @@ -49,4 +50,13 @@ internal static string BuildPolicyJson(SnsPolicyDetails policyDetails) ] }}"; } + + private static string SerializeAccountIds(IReadOnlyCollection accountIds) + { +#if NET8_0_OR_GREATER + return JsonSerializer.Serialize(accountIds, JustSayingSerializationContext.Default.IReadOnlyCollectionString); +#else + return JsonSerializer.Serialize(accountIds); +#endif + } } diff --git a/src/JustSaying/AwsTools/QueueCreation/ConfigurationErrorsException.cs b/src/JustSaying/AwsTools/QueueCreation/ConfigurationErrorsException.cs index ce044dcfe..18838c4e2 100644 --- a/src/JustSaying/AwsTools/QueueCreation/ConfigurationErrorsException.cs +++ b/src/JustSaying/AwsTools/QueueCreation/ConfigurationErrorsException.cs @@ -17,7 +17,9 @@ public ConfigurationErrorsException(string message, Exception inner) : base(mess { } +#if !NET8_0_OR_GREATER protected ConfigurationErrorsException(SerializationInfo info, StreamingContext context) : base(info, context) { } -} \ No newline at end of file +#endif +} diff --git a/src/JustSaying/Constants.cs b/src/JustSaying/Constants.cs new file mode 100644 index 000000000..de2f4236a --- /dev/null +++ b/src/JustSaying/Constants.cs @@ -0,0 +1,7 @@ +namespace JustSaying; + +internal static class Constants +{ + internal const string SerializationUnreferencedCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved."; + internal const string SerializationDynamicCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext."; +} diff --git a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs new file mode 100644 index 000000000..b9779d98a --- /dev/null +++ b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs @@ -0,0 +1,21 @@ +#if NET8_0_OR_GREATER +using System.Text.Json; +using System.Text.Json.Serialization.Metadata; + +namespace JustSaying.Extensions; + + +internal static class JsonSerializerOptionsExtensions +{ + public static JsonTypeInfo GetTypeInfo(this JsonSerializerOptions options) + { + var typeInfo = options.GetTypeInfo(typeof(T)); + if (typeInfo is not JsonTypeInfo genericTypeInfo) + { + throw new JsonException($"Could not find type info for the specified type {typeof(T).Name}"); + } + + return genericTypeInfo; + } +} +#endif diff --git a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs index 5b1e8c8d6..43fdc7940 100644 --- a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs +++ b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs @@ -1,3 +1,4 @@ +using System.Runtime.CompilerServices; using JustSaying.AwsTools; using JustSaying.Messaging.MessageSerialization; using JustSaying.Messaging.Monitoring; @@ -44,7 +45,22 @@ private object TryResolveService(Type desiredType) } else if (desiredType == typeof(IMessageSerializationFactory)) { + +#if NET8_0_OR_GREATER + if (!RuntimeFeature.IsDynamicCodeSupported) + { + #pragma warning disable IL2026 + #pragma warning disable IL3050 + return new NewtonsoftSerializationFactory(); + #pragma warning restore + } + else + { + throw new NotSupportedException($"Newtonsoft.Json is not supported when compiled with the 'PublishTrimmed' option. Use {nameof(TypedSystemTextJsonSerializationFactory)} instead."); + } +#else return new NewtonsoftSerializationFactory(); +#endif } else if (desiredType == typeof(IMessageSerializationRegister)) { @@ -63,4 +79,4 @@ private object TryResolveService(Type desiredType) return null; } -} \ No newline at end of file +} diff --git a/src/JustSaying/HandlerNotRegisteredWithContainerException.cs b/src/JustSaying/HandlerNotRegisteredWithContainerException.cs index 067aeca86..084a6fea2 100644 --- a/src/JustSaying/HandlerNotRegisteredWithContainerException.cs +++ b/src/JustSaying/HandlerNotRegisteredWithContainerException.cs @@ -17,7 +17,9 @@ public HandlerNotRegisteredWithContainerException(string message, Exception inne { } +#if !NET8_0_OR_GREATER protected HandlerNotRegisteredWithContainerException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } diff --git a/src/JustSaying/JustSaying.csproj b/src/JustSaying/JustSaying.csproj index 140f0c950..fb4cbf46c 100644 --- a/src/JustSaying/JustSaying.csproj +++ b/src/JustSaying/JustSaying.csproj @@ -1,7 +1,7 @@  true - netstandard2.0;net461 + netstandard2.0;net461;net8.0 @@ -23,4 +23,10 @@ + + + + + true + diff --git a/src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs b/src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs new file mode 100644 index 000000000..4f840c709 --- /dev/null +++ b/src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs @@ -0,0 +1,9 @@ +#if NET8_0_OR_GREATER +using System.Text.Json.Serialization; + +namespace JustSaying.Messaging.MessageSerialization; + +[JsonSerializable(typeof(SqsMessageEnvelope))] +[JsonSerializable(typeof(IReadOnlyCollection))] +internal sealed partial class JustSayingSerializationContext : JsonSerializerContext; +#endif diff --git a/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs b/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs index 0db0f479a..837a5be93 100644 --- a/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs +++ b/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs @@ -16,8 +16,10 @@ public MessageFormatNotSupportedException(string message) : base(message) public MessageFormatNotSupportedException(string message, Exception innerException) : base(message, innerException) { } +#if !NET8_0_OR_GREATER protected MessageFormatNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } -} \ No newline at end of file +#endif +} diff --git a/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializationFactory.cs index da7ebbe97..1cc0eb294 100644 --- a/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializationFactory.cs +++ b/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializationFactory.cs @@ -3,6 +3,10 @@ namespace JustSaying.Messaging.MessageSerialization; +#if NET8_0_OR_GREATER +[RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] +[RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] +#endif public class NewtonsoftSerializationFactory(JsonSerializerSettings settings) : IMessageSerializationFactory { private readonly NewtonsoftSerializer _serializer = new(settings); diff --git a/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializer.cs b/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializer.cs index 68c5b5d25..10092e5b1 100644 --- a/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializer.cs +++ b/src/JustSaying/Messaging/MessageSerialization/NewtonsoftSerializer.cs @@ -5,6 +5,10 @@ namespace JustSaying.Messaging.MessageSerialization; +#if NET8_0_OR_GREATER +[RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] +[RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] +#endif public class NewtonsoftSerializer : IMessageSerializer { private readonly JsonSerializerSettings _settings; diff --git a/src/JustSaying/Messaging/MessageSerialization/SqsMessageEnvelope.cs b/src/JustSaying/Messaging/MessageSerialization/SqsMessageEnvelope.cs new file mode 100644 index 000000000..ea7e3c0af --- /dev/null +++ b/src/JustSaying/Messaging/MessageSerialization/SqsMessageEnvelope.cs @@ -0,0 +1,8 @@ +namespace JustSaying.Messaging.MessageSerialization; + +internal sealed class SqsMessageEnvelope +{ + public string Subject { get; set; } + + public string Message { get; set; } +} diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs index 023957b78..47db48e1c 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs @@ -3,6 +3,10 @@ namespace JustSaying.Messaging.MessageSerialization; +#if NET8_0_OR_GREATER +[RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] +[RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] +#endif public class SystemTextJsonSerializationFactory(JsonSerializerOptions options) : IMessageSerializationFactory { private readonly SystemTextJsonSerializer _serializer = new(options); diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs index 50f5c2697..8a94f4513 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs @@ -8,7 +8,11 @@ namespace JustSaying.Messaging.MessageSerialization; /// /// A class representing an implementation of for the System.Text.Json serializer. /// -public class SystemTextJsonSerializer : IMessageSerializer +#if NET8_0_OR_GREATER +[RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] +[RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] +#endif +public partial class SystemTextJsonSerializer : IMessageSerializer { private readonly JsonSerializerOptions _options; @@ -30,7 +34,11 @@ public SystemTextJsonSerializer(JsonSerializerOptions options) { options = new JsonSerializerOptions { - IgnoreNullValues = true +#if NET8_0_OR_GREATER + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, +#else + IgnoreNullValues = true, +#endif }; options.Converters.Add(new JsonStringEnumConverter()); diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs new file mode 100644 index 000000000..57add010f --- /dev/null +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs @@ -0,0 +1,119 @@ +#if NET8_0_OR_GREATER +using System.Text.Json; +using System.Text.Json.Serialization; +using JustSaying.Extensions; +using JustSaying.Messaging.MessageHandling; +using JustSaying.Models; + +namespace JustSaying.Messaging.MessageSerialization; + +/// +/// A class representing an implementation of for the System.Text.Json serializer. +/// +public class SystemTextJsonSerializer : IMessageSerializer + where T : Message +{ + private readonly JsonSerializerOptions _options; + + /// + /// Initializes a new instance of the class. + /// + public SystemTextJsonSerializer() + : this(null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The optional to use. + public SystemTextJsonSerializer(JsonSerializerOptions options) + { + if (options == null) + { + options = new JsonSerializerOptions + { +#if NET8_0_OR_GREATER + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, +#else + IgnoreNullValues = true, +#endif + }; + } + + _options = options; + } + + /// + public string GetMessageSubject(string sqsMessage) + { + using var body = JsonDocument.Parse(sqsMessage); + string subject = string.Empty; + + if (body.RootElement.TryGetProperty("Subject", out var value)) + { + subject = value.GetString() ?? string.Empty; + } + + return subject; + } + + public MessageAttributes GetMessageAttributes(string message) + { + var jsonDocument = JsonDocument.Parse(message); + + if (!jsonDocument.RootElement.TryGetProperty("MessageAttributes", out var attributesElement)) + { + return new MessageAttributes(); + } + + var attributes = new Dictionary(); + foreach(var obj in attributesElement.EnumerateObject()) + { + var dataType = obj.Value.GetProperty("Type").GetString(); + var dataValue = obj.Value.GetProperty("Value").GetString(); + + var isString = dataType == "String"; + + attributes.Add(obj.Name, new MessageAttributeValue() + { + DataType = dataType, + StringValue = isString ? dataValue : null, + BinaryValue = !isString ? Convert.FromBase64String(dataValue) : null + }); + } + + return new MessageAttributes(attributes); + } + + /// + public Message Deserialize(string message, Type type) + { + using var document = JsonDocument.Parse(message); + JsonElement element = document.RootElement.GetProperty("Message"); + string json = element.ToString(); + var jsonTypeInfo = _options.GetTypeInfo(); + + return (Message)JsonSerializer.Deserialize(json, jsonTypeInfo); + } + + /// + public string Serialize(Message message, bool serializeForSnsPublishing, string subject) + { + + var jsonTypeInfo = _options.GetTypeInfo(); + string json = JsonSerializer.Serialize(message, jsonTypeInfo); + + // AWS SNS service will add Subject and Message properties automatically, + // so just return plain message + if (serializeForSnsPublishing) + { + return json; + } + + // For direct publishing to SQS, add Subject and Message properties manually + var context = new SqsMessageEnvelope { Subject = subject, Message = json }; + return JsonSerializer.Serialize(context, JustSayingSerializationContext.Default.SqsMessageEnvelope); + } +} +#endif diff --git a/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs new file mode 100644 index 000000000..e4edbacdf --- /dev/null +++ b/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs @@ -0,0 +1,11 @@ +#if NET8_0_OR_GREATER +using System.Text.Json; +using JustSaying.Models; + +namespace JustSaying.Messaging.MessageSerialization; + +public class TypedSystemTextJsonSerializationFactory(JsonSerializerOptions options) : IMessageSerializationFactory +{ + public IMessageSerializer GetSerializer() where T : Message => new SystemTextJsonSerializer(options); +} +#endif diff --git a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Shipped.txt b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000..a1c0546c3 --- /dev/null +++ b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Shipped.txt @@ -0,0 +1,745 @@ +abstract JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.GetCreateQueueAttributes(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig) -> System.Collections.Generic.Dictionary +abstract JustSaying.Messaging.Middleware.MiddlewareBase.RunInnerAsync(TContext context, System.Func> func, System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +const JustSaying.AwsTools.JustSayingConstants.AttributeArn = "QueueArn" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeDeliveryDelay = "DelaySeconds" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeEncryptionKeyId = "KmsMasterKeyId" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeEncryptionKeyReusePeriodSecondId = "KmsDataKeyReusePeriodSeconds" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributePolicy = "Policy" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeRedrivePolicy = "RedrivePolicy" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeRetentionPeriod = "MessageRetentionPeriod" -> string +const JustSaying.AwsTools.JustSayingConstants.AttributeVisibilityTimeout = "VisibilityTimeout" -> string +JustSaying.AwsTools.AwsClientFactoryProxy +JustSaying.AwsTools.AwsClientFactoryProxy.AwsClientFactoryProxy() -> void +JustSaying.AwsTools.AwsClientFactoryProxy.AwsClientFactoryProxy(System.Func awsClientFactoryFunc) -> void +JustSaying.AwsTools.AwsClientFactoryProxy.AwsClientFactoryProxy(System.Lazy factory) -> void +JustSaying.AwsTools.AwsClientFactoryProxy.GetAwsClientFactory() -> JustSaying.AwsTools.IAwsClientFactory +JustSaying.AwsTools.AwsClientFactoryProxy.SetAwsClientFactory(System.Func func) -> void +JustSaying.AwsTools.DefaultAwsClientFactory +JustSaying.AwsTools.DefaultAwsClientFactory.DefaultAwsClientFactory() -> void +JustSaying.AwsTools.DefaultAwsClientFactory.DefaultAwsClientFactory(Amazon.Runtime.AWSCredentials customCredentials) -> void +JustSaying.AwsTools.DefaultAwsClientFactory.GetSnsClient(Amazon.RegionEndpoint region) -> Amazon.SimpleNotificationService.IAmazonSimpleNotificationService +JustSaying.AwsTools.DefaultAwsClientFactory.GetSqsClient(Amazon.RegionEndpoint region) -> Amazon.SQS.IAmazonSQS +JustSaying.AwsTools.DefaultAwsClientFactory.ServiceUri.get -> System.Uri +JustSaying.AwsTools.DefaultAwsClientFactory.ServiceUri.set -> void +JustSaying.AwsTools.ErrorQueue +JustSaying.AwsTools.ErrorQueue.ErrorQueue(Amazon.RegionEndpoint region, string sourceQueueName, Amazon.SQS.IAmazonSQS client, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.IAwsClientFactory +JustSaying.AwsTools.IAwsClientFactory.GetSnsClient(Amazon.RegionEndpoint region) -> Amazon.SimpleNotificationService.IAmazonSimpleNotificationService +JustSaying.AwsTools.IAwsClientFactory.GetSqsClient(Amazon.RegionEndpoint region) -> Amazon.SQS.IAmazonSQS +JustSaying.AwsTools.IAwsClientFactoryProxy +JustSaying.AwsTools.IAwsClientFactoryProxy.GetAwsClientFactory() -> JustSaying.AwsTools.IAwsClientFactory +JustSaying.AwsTools.IAwsClientFactoryProxy.SetAwsClientFactory(System.Func func) -> void +JustSaying.AwsTools.JustSayingConstants +JustSaying.AwsTools.MessageHandling.Dispatch.IMessageDispatcher +JustSaying.AwsTools.MessageHandling.Dispatch.IMessageDispatcher.DispatchMessageAsync(JustSaying.Messaging.Channels.Context.IQueueMessageContext messageContext, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.Dispatch.MessageDispatcher +JustSaying.AwsTools.MessageHandling.Dispatch.MessageDispatcher.DispatchMessageAsync(JustSaying.Messaging.Channels.Context.IQueueMessageContext messageContext, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.Dispatch.MessageDispatcher.MessageDispatcher(JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, JustSaying.Messaging.Monitoring.IMessageMonitor messagingMonitor, JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap middlewareMap, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.Add(string queueName, JustSaying.Messaging.Middleware.MiddlewareBase middleware) -> JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.Contains(string queueName, System.Type messageType) -> bool +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.Get(string queueName, System.Type messageType) -> JustSaying.Messaging.Middleware.MiddlewareBase +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.MiddlewareMap() -> void +JustSaying.AwsTools.MessageHandling.Dispatch.MiddlewareMap.Types.get -> System.Collections.Generic.IEnumerable +JustSaying.AwsTools.MessageHandling.ISqsQueue +JustSaying.AwsTools.MessageHandling.ISqsQueue.Arn.get -> string +JustSaying.AwsTools.MessageHandling.ISqsQueue.ChangeMessageVisibilityAsync(string queueUrl, string receiptHandle, int visibilityTimeoutInSeconds, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.ISqsQueue.DeleteMessageAsync(string queueUrl, string receiptHandle, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.ISqsQueue.QueueName.get -> string +JustSaying.AwsTools.MessageHandling.ISqsQueue.ReceiveMessagesAsync(string queueUrl, int maxNumOfMessages, int secondsWaitTime, System.Collections.Generic.IList attributesToLoad, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> +JustSaying.AwsTools.MessageHandling.ISqsQueue.RegionSystemName.get -> string +JustSaying.AwsTools.MessageHandling.ISqsQueue.TagQueueAsync(string queueUrl, System.Collections.Generic.Dictionary tags, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.ISqsQueue.Uri.get -> System.Uri +JustSaying.AwsTools.MessageHandling.MessageResponse +JustSaying.AwsTools.MessageHandling.MessageResponse.HttpStatusCode.get -> System.Net.HttpStatusCode? +JustSaying.AwsTools.MessageHandling.MessageResponse.HttpStatusCode.set -> void +JustSaying.AwsTools.MessageHandling.MessageResponse.MessageId.get -> string +JustSaying.AwsTools.MessageHandling.MessageResponse.MessageId.set -> void +JustSaying.AwsTools.MessageHandling.MessageResponse.MessageResponse() -> void +JustSaying.AwsTools.MessageHandling.MessageResponse.ResponseMetadata.get -> Amazon.Runtime.ResponseMetadata +JustSaying.AwsTools.MessageHandling.MessageResponse.ResponseMetadata.set -> void +JustSaying.AwsTools.MessageHandling.PublishException +JustSaying.AwsTools.MessageHandling.PublishException.PublishException() -> void +JustSaying.AwsTools.MessageHandling.PublishException.PublishException(string message) -> void +JustSaying.AwsTools.MessageHandling.PublishException.PublishException(string message, System.Exception inner) -> void +JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup +JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup.Queue.get -> JustSaying.AwsTools.MessageHandling.ISqsQueue +JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup.QueueWithAsyncStartup(JustSaying.AwsTools.MessageHandling.ISqsQueue queue) -> void +JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup.QueueWithAsyncStartup(System.Func startupTask, JustSaying.AwsTools.MessageHandling.ISqsQueue queue) -> void +JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup.StartupTask.get -> System.Func +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.Arn.get -> string +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.Client.get -> Amazon.SimpleNotificationService.IAmazonSimpleNotificationService +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.MessageResponseLogger.get -> System.Action +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.MessageResponseLogger.set -> void +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.PublishAsync(JustSaying.Models.Message message, JustSaying.Messaging.PublishMetadata metadata, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.PublishAsync(JustSaying.Models.Message message, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.SnsMessagePublisher(Amazon.SimpleNotificationService.IAmazonSimpleNotificationService client, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider messageSubjectProvider, System.Func handleException = null) -> void +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.SnsMessagePublisher(string topicArn, Amazon.SimpleNotificationService.IAmazonSimpleNotificationService client, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider messageSubjectProvider, System.Func handleException = null) -> void +JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.StartAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName +JustSaying.AwsTools.MessageHandling.SnsTopicByName.ApplyTagsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName.Arn.get -> string +JustSaying.AwsTools.MessageHandling.SnsTopicByName.CreateAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName.CreateWithEncryptionAsync(JustSaying.AwsTools.QueueCreation.ServerSideEncryption config, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName.EnsurePolicyIsUpdatedAsync(System.Collections.Generic.IReadOnlyCollection additionalSubscriberAccounts) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName.ExistsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SnsTopicByName.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.AwsTools.MessageHandling.SnsTopicByName.SnsTopicByName(string topicName, Amazon.SimpleNotificationService.IAmazonSimpleNotificationService client, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.SnsTopicByName.Tags.get -> System.Collections.Generic.IDictionary +JustSaying.AwsTools.MessageHandling.SnsTopicByName.Tags.set -> void +JustSaying.AwsTools.MessageHandling.SnsTopicByName.TopicName.get -> string +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.GetMessageInContext(JustSaying.Models.Message message) -> string +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.MessageResponseLogger.get -> System.Action +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.MessageResponseLogger.set -> void +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.PublishAsync(JustSaying.Models.Message message, JustSaying.Messaging.PublishMetadata metadata, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.PublishAsync(JustSaying.Models.Message message, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.QueueUrl.get -> System.Uri +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.SqsMessagePublisher(Amazon.SQS.IAmazonSQS client, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.SqsMessagePublisher(System.Uri queueUrl, Amazon.SQS.IAmazonSQS client, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.SqsMessagePublisher.StartAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsQueueByName +JustSaying.AwsTools.MessageHandling.SqsQueueByName.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(JustSaying.AwsTools.QueueCreation.SqsReadConfiguration queueConfig, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsQueueByName.SqsQueueByName(Amazon.RegionEndpoint region, string queueName, Amazon.SQS.IAmazonSQS client, int retryCountBeforeSendingToErrorQueue, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.Arn.get -> string +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.ChangeMessageVisibilityAsync(string queueUrl, string receiptHandle, int visibilityTimeoutInSeconds, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.Client.get -> Amazon.SQS.IAmazonSQS +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.DeleteMessageAsync(string queueUrl, string receiptHandle, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.Logger.get -> Microsoft.Extensions.Logging.ILogger +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.QueueName.get -> string +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.ReceiveMessagesAsync(string queueUrl, int maxNumOfMessages, int secondsWaitTime, System.Collections.Generic.IList attributesToLoad, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.RegionSystemName.get -> string +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.SqsQueueByNameBase(Amazon.RegionEndpoint region, string queueName, Amazon.SQS.IAmazonSQS client, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.TagQueueAsync(string queueUrl, System.Collections.Generic.Dictionary tags, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.Uri.get -> System.Uri +JustSaying.AwsTools.QueueCreation.AmazonQueueCreator +JustSaying.AwsTools.QueueCreation.AmazonQueueCreator.AmazonQueueCreator(JustSaying.AwsTools.IAwsClientFactoryProxy awsClientFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.AwsTools.QueueCreation.AmazonQueueCreator.EnsureQueueExists(string region, JustSaying.AwsTools.QueueCreation.SqsReadConfiguration queueConfig) -> JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup +JustSaying.AwsTools.QueueCreation.AmazonQueueCreator.EnsureTopicExistsWithQueueSubscribed(string region, JustSaying.AwsTools.QueueCreation.SqsReadConfiguration queueConfig) -> JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup +JustSaying.AwsTools.QueueCreation.ConfigurationErrorsException +JustSaying.AwsTools.QueueCreation.ConfigurationErrorsException.ConfigurationErrorsException() -> void +JustSaying.AwsTools.QueueCreation.ConfigurationErrorsException.ConfigurationErrorsException(string message) -> void +JustSaying.AwsTools.QueueCreation.ConfigurationErrorsException.ConfigurationErrorsException(string message, System.Exception inner) -> void +JustSaying.AwsTools.QueueCreation.IVerifyAmazonQueues +JustSaying.AwsTools.QueueCreation.IVerifyAmazonQueues.EnsureQueueExists(string region, JustSaying.AwsTools.QueueCreation.SqsReadConfiguration queueConfig) -> JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup +JustSaying.AwsTools.QueueCreation.IVerifyAmazonQueues.EnsureTopicExistsWithQueueSubscribed(string region, JustSaying.AwsTools.QueueCreation.SqsReadConfiguration queueConfig) -> JustSaying.AwsTools.MessageHandling.QueueWithAsyncStartup +JustSaying.AwsTools.QueueCreation.RedrivePolicy +JustSaying.AwsTools.QueueCreation.RedrivePolicy.DeadLetterQueue.get -> string +JustSaying.AwsTools.QueueCreation.RedrivePolicy.DeadLetterQueue.set -> void +JustSaying.AwsTools.QueueCreation.RedrivePolicy.MaximumReceives.get -> int +JustSaying.AwsTools.QueueCreation.RedrivePolicy.MaximumReceives.set -> void +JustSaying.AwsTools.QueueCreation.RedrivePolicy.RedrivePolicy() -> void +JustSaying.AwsTools.QueueCreation.RedrivePolicy.RedrivePolicy(int maximumReceives, string deadLetterQueue) -> void +JustSaying.AwsTools.QueueCreation.ServerSideEncryption +JustSaying.AwsTools.QueueCreation.ServerSideEncryption.KmsDataKeyReusePeriod.get -> System.TimeSpan +JustSaying.AwsTools.QueueCreation.ServerSideEncryption.KmsDataKeyReusePeriod.set -> void +JustSaying.AwsTools.QueueCreation.ServerSideEncryption.KmsMasterKeyId.get -> string +JustSaying.AwsTools.QueueCreation.ServerSideEncryption.KmsMasterKeyId.set -> void +JustSaying.AwsTools.QueueCreation.ServerSideEncryption.ServerSideEncryption() -> void +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration.Encryption.get -> JustSaying.AwsTools.QueueCreation.ServerSideEncryption +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration.Encryption.set -> void +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration.HandleException.get -> System.Func +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration.HandleException.set -> void +JustSaying.AwsTools.QueueCreation.SnsWriteConfiguration.SnsWriteConfiguration() -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ApplyQueueNamingConvention(JustSaying.Naming.IQueueNamingConvention namingConvention) -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.DeliveryDelay.get -> System.TimeSpan +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.DeliveryDelay.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ErrorQueueOptOut.get -> bool +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ErrorQueueOptOut.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ErrorQueueRetentionPeriod.get -> System.TimeSpan +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ErrorQueueRetentionPeriod.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.MessageRetention.get -> System.TimeSpan +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.MessageRetention.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.QueueName.get -> string +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.QueueName.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.RetryCountBeforeSendingToErrorQueue.get -> int +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.RetryCountBeforeSendingToErrorQueue.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ServerSideEncryption.get -> JustSaying.AwsTools.QueueCreation.ServerSideEncryption +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.ServerSideEncryption.set -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.SqsBasicConfiguration() -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.Validate() -> void +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.VisibilityTimeout.get -> System.TimeSpan +JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.VisibilityTimeout.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.ApplyTopicNamingConvention(JustSaying.Naming.ITopicNamingConvention namingConvention) -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.FilterPolicy.get -> string +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.FilterPolicy.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.PublishEndpoint.get -> string +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.PublishEndpoint.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.SqsReadConfiguration(JustSaying.AwsTools.QueueCreation.SubscriptionType subscriptionType) -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.SubscriptionGroupName.get -> string +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.SubscriptionGroupName.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.SubscriptionType.get -> JustSaying.AwsTools.QueueCreation.SubscriptionType +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.Tags.get -> System.Collections.Generic.Dictionary +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.Tags.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.TopicName.get -> string +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.TopicName.set -> void +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.TopicSourceAccount.get -> string +JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.TopicSourceAccount.set -> void +JustSaying.AwsTools.QueueCreation.SqsWriteConfiguration +JustSaying.AwsTools.QueueCreation.SqsWriteConfiguration.SqsWriteConfiguration() -> void +JustSaying.AwsTools.QueueCreation.SubscriptionType +JustSaying.AwsTools.QueueCreation.SubscriptionType.PointToPoint = 1 -> JustSaying.AwsTools.QueueCreation.SubscriptionType +JustSaying.AwsTools.QueueCreation.SubscriptionType.ToTopic = 0 -> JustSaying.AwsTools.QueueCreation.SubscriptionType +JustSaying.Extensions.ChannelExtensions +JustSaying.Fluent.AccountAddressProvider +JustSaying.Fluent.AccountAddressProvider.AccountAddressProvider(string accountId, Amazon.RegionEndpoint regionEndpoint) -> void +JustSaying.Fluent.AccountAddressProvider.AccountAddressProvider(string accountId, Amazon.RegionEndpoint regionEndpoint, JustSaying.Naming.IQueueNamingConvention queueNamingConvention, JustSaying.Naming.ITopicNamingConvention topicNamingConvention) -> void +JustSaying.Fluent.AccountAddressProvider.AccountAddressProvider(string accountId, string regionName) -> void +JustSaying.Fluent.AccountAddressProvider.AccountAddressProvider(string accountId, string regionName, JustSaying.Naming.IQueueNamingConvention queueNamingConvention, JustSaying.Naming.ITopicNamingConvention topicNamingConvention) -> void +JustSaying.Fluent.AccountAddressProvider.GetQueueUri(string queueName) -> System.Uri +JustSaying.Fluent.AccountAddressProvider.GetQueueUriByConvention() -> System.Uri +JustSaying.Fluent.AccountAddressProvider.GetTopicArn(string topicName) -> string +JustSaying.Fluent.AccountAddressProvider.GetTopicArnByConvention() -> string +JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.Build() -> JustSaying.AwsTools.IAwsClientFactory +JustSaying.Fluent.AwsClientFactoryBuilder.BusBuilder.get -> JustSaying.MessagingBusBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithAnonymousCredentials() -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithBasicCredentials(string accessKey, string secretKey) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithClientFactory(System.Func clientFactory) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithCredentials(Amazon.Runtime.AWSCredentials credentials) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithServiceUri(System.Uri uri) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithServiceUrl(string url) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.AwsClientFactoryBuilder.WithSessionCredentials(string accessKeyId, string secretAccessKey, string token) -> JustSaying.Fluent.AwsClientFactoryBuilder +JustSaying.Fluent.IMessageBusConfigurationContributor +JustSaying.Fluent.IMessageBusConfigurationContributor.Configure(JustSaying.MessagingBusBuilder builder) -> void +JustSaying.Fluent.IServiceResolver +JustSaying.Fluent.IServiceResolver.ResolveOptionalService() -> T +JustSaying.Fluent.IServiceResolver.ResolveService() -> T +JustSaying.Fluent.ISubscriptionBuilder +JustSaying.Fluent.ISubscriptionBuilder.Configure(JustSaying.JustSayingBus bus, JustSaying.IHandlerResolver handlerResolver, JustSaying.Fluent.IServiceResolver serviceResolver, JustSaying.AwsTools.QueueCreation.IVerifyAmazonQueues creator, JustSaying.AwsTools.IAwsClientFactoryProxy awsClientFactoryProxy, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Fluent.ISubscriptionBuilder.WithMiddlewareConfiguration(System.Action middlewareConfiguration) -> JustSaying.Fluent.ISubscriptionBuilder +JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.Build() -> JustSaying.IMessagingConfig +JustSaying.Fluent.MessagingConfigurationBuilder.BusBuilder.get -> JustSaying.MessagingBusBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithAdditionalSubscriberAccount(string accountId) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithAdditionalSubscriberAccounts(params string[] regions) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithAdditionalSubscriberAccounts(System.Collections.Generic.IEnumerable accountIds) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithMessageResponseLogger(System.Action logger) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithMessageSubjectProvider(JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider subjectProvider) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithPublishFailureBackoff(System.TimeSpan value) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithPublishFailureReattempts(int value) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithQueueNamingConvention(JustSaying.Naming.IQueueNamingConvention namingConvention) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithQueueNamingConvention() -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithRegion(Amazon.RegionEndpoint region) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithRegion(string region) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithTopicNamingConvention(JustSaying.Naming.ITopicNamingConvention namingConvention) -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.MessagingConfigurationBuilder.WithTopicNamingConvention() -> JustSaying.Fluent.MessagingConfigurationBuilder +JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithQueue() -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithQueue(System.Action> configure) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithQueueArn(string queueArn) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithQueueUri(System.Uri queueUrl) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithQueueUrl(string queueUrl) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithTopic() -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithTopic(System.Action> configure) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.PublicationsBuilder.WithTopicArn(string topicArn, System.Action> configure = null) -> JustSaying.Fluent.PublicationsBuilder +JustSaying.Fluent.QueueAddressConfiguration +JustSaying.Fluent.QueueAddressConfiguration.MiddlewareConfiguration.get -> System.Action +JustSaying.Fluent.QueueAddressConfiguration.MiddlewareConfiguration.set -> void +JustSaying.Fluent.QueueAddressConfiguration.QueueAddressConfiguration() -> void +JustSaying.Fluent.QueueAddressConfiguration.SubscriptionGroupName.get -> string +JustSaying.Fluent.QueueAddressConfiguration.SubscriptionGroupName.set -> void +JustSaying.Fluent.QueueAddressConfiguration.Validate() -> void +JustSaying.Fluent.QueueAddressPublicationBuilder +JustSaying.Fluent.QueueAddressPublicationBuilder.Configure(JustSaying.JustSayingBus bus, JustSaying.AwsTools.IAwsClientFactoryProxy proxy, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Fluent.QueueAddressSubscriptionBuilder +JustSaying.Fluent.QueueAddressSubscriptionBuilder.WithMiddlewareConfiguration(System.Action middlewareConfiguration) -> JustSaying.Fluent.ISubscriptionBuilder +JustSaying.Fluent.QueueAddressSubscriptionBuilder.WithReadConfiguration(System.Action configure) -> JustSaying.Fluent.QueueAddressSubscriptionBuilder +JustSaying.Fluent.QueuePublicationBuilder +JustSaying.Fluent.QueuePublicationBuilder.WithName(string queueName) -> JustSaying.Fluent.QueuePublicationBuilder +JustSaying.Fluent.QueuePublicationBuilder.WithWriteConfiguration(System.Action configure) -> JustSaying.Fluent.QueuePublicationBuilder +JustSaying.Fluent.QueuePublicationBuilder.WithWriteConfiguration(System.Action configure) -> JustSaying.Fluent.QueuePublicationBuilder +JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithDefaultQueue() -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithMiddlewareConfiguration(System.Action middlewareConfiguration) -> JustSaying.Fluent.ISubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithQueueName(string name) -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithReadConfiguration(System.Action configure) -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithReadConfiguration(System.Action configure) -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithTag(string key) -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.QueueSubscriptionBuilder.WithTag(string key, string value) -> JustSaying.Fluent.QueueSubscriptionBuilder +JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithHandlerResolver(JustSaying.IHandlerResolver handlerResolver) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithHandlerResolver(System.Func handlerResolver) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithLoggerFactory(System.Func loggerFactory) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithMessageContextAccessor(System.Func contextAccessor) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.ServicesBuilder.WithMessageMonitoring(System.Func monitoring) -> JustSaying.Fluent.ServicesBuilder +JustSaying.Fluent.SnsWriteConfigurationBuilder +JustSaying.Fluent.SnsWriteConfigurationBuilder.SnsWriteConfigurationBuilder() -> void +JustSaying.Fluent.SnsWriteConfigurationBuilder.WithErrorHandler(System.Func handler) -> JustSaying.Fluent.SnsWriteConfigurationBuilder +JustSaying.Fluent.SqsConfigurationBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithEncryption(JustSaying.AwsTools.QueueCreation.ServerSideEncryption encryption) -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithEncryption(string masterKeyId) -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithErrorQueue() -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithErrorQueueOptOut(bool value) -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithMessageRetention(System.TimeSpan value) -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithNoErrorQueue() -> TBuilder +JustSaying.Fluent.SqsConfigurationBuilder.WithVisibilityTimeout(System.TimeSpan value) -> TBuilder +JustSaying.Fluent.SqsReadConfigurationBuilder +JustSaying.Fluent.SqsReadConfigurationBuilder.SqsReadConfigurationBuilder() -> void +JustSaying.Fluent.SqsReadConfigurationBuilder.WithSubscriptionGroup(string subscriptionGroupName) -> JustSaying.Fluent.SqsReadConfigurationBuilder +JustSaying.Fluent.SqsReadConfigurationBuilder.WithTopicSourceAccount(string id) -> JustSaying.Fluent.SqsReadConfigurationBuilder +JustSaying.Fluent.SqsWriteConfigurationBuilder +JustSaying.Fluent.SqsWriteConfigurationBuilder.SqsWriteConfigurationBuilder() -> void +JustSaying.Fluent.SqsWriteConfigurationBuilder.WithQueueName(string name) -> JustSaying.Fluent.SqsWriteConfigurationBuilder +JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForQueue() -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForQueue(System.Action> configure) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForQueueArn(string queueArn, System.Action> configure = null) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForQueueUri(System.Uri queueUrl, string regionName = null, System.Action> configure = null) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForQueueUrl(string queueUrl, string regionName = null, System.Action> configure = null) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForTopic() -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForTopic(string topicNameOverride, System.Action> configure) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.ForTopic(System.Action> configure) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.WithDefaults(System.Action configure) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.SubscriptionsBuilder.WithSubscriptionGroup(string groupName, System.Action action) -> JustSaying.Fluent.SubscriptionsBuilder +JustSaying.Fluent.TopicAddressPublicationBuilder +JustSaying.Fluent.TopicAddressPublicationBuilder.Configure(JustSaying.JustSayingBus bus, JustSaying.AwsTools.IAwsClientFactoryProxy proxy, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Fluent.TopicAddressPublicationBuilder.WithExceptionHandler(System.Func exceptionHandler) -> JustSaying.Fluent.TopicAddressPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.TopicNameCustomizer.get -> System.Func +JustSaying.Fluent.TopicPublicationBuilder.TopicNameCustomizer.set -> void +JustSaying.Fluent.TopicPublicationBuilder.WithTag(string key) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.WithTag(string key, string value) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.WithTopicName(string name) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.WithTopicName(System.Func topicNameCustomizer) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.WithWriteConfiguration(System.Action configure) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicPublicationBuilder.WithWriteConfiguration(System.Action configure) -> JustSaying.Fluent.TopicPublicationBuilder +JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.IntoDefaultTopic() -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithMiddlewareConfiguration(System.Action middlewareConfiguration) -> JustSaying.Fluent.ISubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithQueueName(string name) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithReadConfiguration(System.Action configure) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithReadConfiguration(System.Action configure) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithTag(string key) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithTag(string key, string value) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.Fluent.TopicSubscriptionBuilder.WithTopicName(string name) -> JustSaying.Fluent.TopicSubscriptionBuilder +JustSaying.HandlerNotRegisteredWithContainerException +JustSaying.HandlerNotRegisteredWithContainerException.HandlerNotRegisteredWithContainerException() -> void +JustSaying.HandlerNotRegisteredWithContainerException.HandlerNotRegisteredWithContainerException(string message) -> void +JustSaying.HandlerNotRegisteredWithContainerException.HandlerNotRegisteredWithContainerException(string message, System.Exception inner) -> void +JustSaying.HandlerResolutionContext +JustSaying.HandlerResolutionContext.HandlerResolutionContext(string queueName) -> void +JustSaying.HandlerResolutionContext.QueueName.get -> string +JustSaying.IHandlerResolver +JustSaying.IHandlerResolver.ResolveHandler(JustSaying.HandlerResolutionContext context) -> JustSaying.Messaging.MessageHandling.IHandlerAsync +JustSaying.IMessagingBus +JustSaying.IMessagingConfig +JustSaying.IMessagingConfig.MessageSubjectProvider.get -> JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider +JustSaying.IMessagingConfig.MessageSubjectProvider.set -> void +JustSaying.IMessagingConfig.QueueNamingConvention.get -> JustSaying.Naming.IQueueNamingConvention +JustSaying.IMessagingConfig.QueueNamingConvention.set -> void +JustSaying.IMessagingConfig.Region.get -> string +JustSaying.IMessagingConfig.Region.set -> void +JustSaying.IMessagingConfig.TopicNamingConvention.get -> JustSaying.Naming.ITopicNamingConvention +JustSaying.IMessagingConfig.TopicNamingConvention.set -> void +JustSaying.IMessagingConfig.Validate() -> void +JustSaying.IPublishConfiguration +JustSaying.IPublishConfiguration.AdditionalSubscriberAccounts.get -> System.Collections.Generic.IReadOnlyCollection +JustSaying.IPublishConfiguration.AdditionalSubscriberAccounts.set -> void +JustSaying.IPublishConfiguration.MessageResponseLogger.get -> System.Action +JustSaying.IPublishConfiguration.MessageResponseLogger.set -> void +JustSaying.IPublishConfiguration.PublishFailureBackoff.get -> System.TimeSpan +JustSaying.IPublishConfiguration.PublishFailureBackoff.set -> void +JustSaying.IPublishConfiguration.PublishFailureReAttempts.get -> int +JustSaying.IPublishConfiguration.PublishFailureReAttempts.set -> void +JustSaying.IStartable +JustSaying.IStartable.StartAsync(System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +JustSaying.JustSayingBus +JustSaying.JustSayingBus.AddMessageMiddleware(string queueName, JustSaying.Messaging.Middleware.MiddlewareBase middleware) -> void +JustSaying.JustSayingBus.AddMessagePublisher(JustSaying.Messaging.IMessagePublisher messagePublisher) -> void +JustSaying.JustSayingBus.AddQueue(string subscriptionGroup, JustSaying.AwsTools.MessageHandling.ISqsQueue queue) -> void +JustSaying.JustSayingBus.Completion.get -> System.Threading.Tasks.Task +JustSaying.JustSayingBus.Config.get -> JustSaying.IMessagingConfig +JustSaying.JustSayingBus.Dispose() -> void +JustSaying.JustSayingBus.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.JustSayingBus.JustSayingBus(JustSaying.IMessagingConfig config, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal messageReceivePauseSignal, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, JustSaying.Messaging.Monitoring.IMessageMonitor monitor) -> void +JustSaying.JustSayingBus.JustSayingBus(JustSaying.IMessagingConfig config, JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister serializationRegister, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, JustSaying.Messaging.Monitoring.IMessageMonitor monitor) -> void +JustSaying.JustSayingBus.PublishAsync(JustSaying.Models.Message message, JustSaying.Messaging.PublishMetadata metadata, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.JustSayingBus.PublishAsync(JustSaying.Models.Message message, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.JustSayingBus.SerializationRegister.get -> JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister +JustSaying.JustSayingBus.SetGroupSettings(JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder defaults, System.Collections.Generic.IDictionary settings) -> void +JustSaying.JustSayingBus.StartAsync(System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.Context.IMessageDeleter +JustSaying.Messaging.Channels.Context.IMessageDeleter.DeleteMessage(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.Context.IMessageVisibilityUpdater +JustSaying.Messaging.Channels.Context.IMessageVisibilityUpdater.UpdateMessageVisibilityTimeout(System.TimeSpan visibilityTimeout, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.Context.IQueueMessageContext +JustSaying.Messaging.Channels.Context.IQueueMessageContext.Message.get -> Amazon.SQS.Model.Message +JustSaying.Messaging.Channels.Context.IQueueMessageContext.QueueName.get -> string +JustSaying.Messaging.Channels.Context.IQueueMessageContext.QueueUri.get -> System.Uri +JustSaying.Messaging.Channels.Context.QueueMessageContext +JustSaying.Messaging.Channels.Context.QueueMessageContext.DeleteMessage(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.Context.QueueMessageContext.Message.get -> Amazon.SQS.Model.Message +JustSaying.Messaging.Channels.Context.QueueMessageContext.QueueName.get -> string +JustSaying.Messaging.Channels.Context.QueueMessageContext.QueueUri.get -> System.Uri +JustSaying.Messaging.Channels.Context.QueueMessageContext.UpdateMessageVisibilityTimeout(System.TimeSpan visibilityTimeout, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal +JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal.IsPaused.get -> bool +JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal.Pause() -> void +JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal.Resume() -> void +JustSaying.Messaging.Channels.Receive.MessageReceivePauseSignal +JustSaying.Messaging.Channels.Receive.MessageReceivePauseSignal.IsPaused.get -> bool +JustSaying.Messaging.Channels.Receive.MessageReceivePauseSignal.MessageReceivePauseSignal() -> void +JustSaying.Messaging.Channels.Receive.MessageReceivePauseSignal.Pause() -> void +JustSaying.Messaging.Channels.Receive.MessageReceivePauseSignal.Resume() -> void +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroup +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroup.RunAsync(System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupFactory +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupFactory.Create(JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder defaults, System.Collections.Generic.IDictionary subscriptionGroupSettings) -> JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroup +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.BufferSize.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.ConcurrencyLimit.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.MultiplexerCapacity.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.Prefetch.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.ReceiveBufferReadTimeout.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings.ReceiveMessagesWaitTime.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupCollection +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupCollection.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupCollection.RunAsync(System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupCollection.SubscriptionGroupCollection(System.Collections.Generic.IList subscriptionGroups, Microsoft.Extensions.Logging.ILogger logger) -> void +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.AddQueue(JustSaying.AwsTools.MessageHandling.ISqsQueue sqsQueue) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.AddQueues(System.Collections.Generic.IEnumerable sqsQueues) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.Build(JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder defaults) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.SubscriptionGroupConfigBuilder(string groupName) -> void +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithBufferSize(int bufferSize) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithConcurrencyLimit(int concurrencyLimit) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithMultiplexerCapacity(int multiplexerCapacity) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithPrefetch(int prefetch) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithReceiveBufferReadTimeout(System.TimeSpan receiveBufferReadTimeout) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder.WithReceiveMessagesWaitTime(System.TimeSpan waitTime) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupConfigBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupFactory +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupFactory.Create(JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder defaults, System.Collections.Generic.IDictionary subscriptionGroupSettings) -> JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroup +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupFactory.SubscriptionGroupFactory(JustSaying.AwsTools.MessageHandling.Dispatch.IMessageDispatcher messageDispatcher, JustSaying.Messaging.Channels.Receive.IMessageReceivePauseSignal messageReceivePauseSignal, JustSaying.Messaging.Monitoring.IMessageMonitor monitor, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupFactory.SubscriptionGroupFactory(JustSaying.AwsTools.MessageHandling.Dispatch.IMessageDispatcher messageDispatcher, JustSaying.Messaging.Monitoring.IMessageMonitor monitor, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.BufferSize.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.ConcurrencyLimit.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.MultiplexerCapacity.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.Name.get -> string +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.Prefetch.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.Queues.get -> System.Collections.Generic.IReadOnlyCollection +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.ReceiveBufferReadTimeout.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettings.ReceiveMessagesWaitTime.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.BufferSize.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.ConcurrencyLimit.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.MultiplexerCapacity.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.Prefetch.get -> int +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.ReceiveBufferReadTimeout.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.ReceiveMessagesWaitTime.get -> System.TimeSpan +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.SqsMiddleware.get -> JustSaying.Messaging.Middleware.MiddlewareBase> +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.SubscriptionGroupSettingsBuilder() -> void +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithCustomMiddleware(JustSaying.Messaging.Middleware.MiddlewareBase> middleware) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultBufferSize(int bufferSize) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultConcurrencyLimit(int concurrencyLimit) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultMultiplexerCapacity(int multiplexerCapacity) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultPrefetch(int prefetch) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultReceiveBufferReadTimeout(System.TimeSpan receiveBufferReadTimeout) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder.WithDefaultReceiveMessagesWaitTime(System.TimeSpan waitTime) -> JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsBuilder +JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsValidation +JustSaying.Messaging.IMessagePublisher +JustSaying.Messaging.IMessagePublisher.PublishAsync(JustSaying.Models.Message message, JustSaying.Messaging.PublishMetadata metadata, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.IMessagePublisher.PublishAsync(JustSaying.Models.Message message, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Interrogation.IInterrogable +JustSaying.Messaging.Interrogation.IInterrogable.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.Messaging.Interrogation.InterrogationResult +JustSaying.Messaging.Interrogation.InterrogationResult.Data.get -> object +JustSaying.Messaging.Interrogation.InterrogationResult.InterrogationResult(object data) -> void +JustSaying.Messaging.MessageAttributeValue +JustSaying.Messaging.MessageAttributeValue.BinaryValue.get -> System.Collections.Generic.IReadOnlyCollection +JustSaying.Messaging.MessageAttributeValue.BinaryValue.set -> void +JustSaying.Messaging.MessageAttributeValue.DataType.get -> string +JustSaying.Messaging.MessageAttributeValue.DataType.set -> void +JustSaying.Messaging.MessageAttributeValue.MessageAttributeValue() -> void +JustSaying.Messaging.MessageAttributeValue.StringValue.get -> string +JustSaying.Messaging.MessageAttributeValue.StringValue.set -> void +JustSaying.Messaging.MessageHandling.IHandlerAsync +JustSaying.Messaging.MessageHandling.IHandlerAsync.Handle(T message) -> System.Threading.Tasks.Task +JustSaying.Messaging.MessageHandling.IMessageContextAccessor +JustSaying.Messaging.MessageHandling.IMessageContextAccessor.MessageContext.get -> JustSaying.Messaging.MessageHandling.MessageContext +JustSaying.Messaging.MessageHandling.IMessageContextAccessor.MessageContext.set -> void +JustSaying.Messaging.MessageHandling.IMessageContextReader +JustSaying.Messaging.MessageHandling.IMessageContextReader.MessageContext.get -> JustSaying.Messaging.MessageHandling.MessageContext +JustSaying.Messaging.MessageHandling.IMessageLockAsync +JustSaying.Messaging.MessageHandling.IMessageLockAsync.ReleaseLockAsync(string key) -> System.Threading.Tasks.Task +JustSaying.Messaging.MessageHandling.IMessageLockAsync.TryAcquireLockAsync(string key, System.TimeSpan howLong) -> System.Threading.Tasks.Task +JustSaying.Messaging.MessageHandling.IMessageLockAsync.TryAcquireLockPermanentlyAsync(string key) -> System.Threading.Tasks.Task +JustSaying.Messaging.MessageHandling.ListHandler +JustSaying.Messaging.MessageHandling.ListHandler.Handle(T message) -> System.Threading.Tasks.Task +JustSaying.Messaging.MessageHandling.ListHandler.ListHandler(System.Collections.Generic.IEnumerable> handlers) -> void +JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageHandling.MessageAttributes.Get(string value) -> JustSaying.Messaging.MessageAttributeValue +JustSaying.Messaging.MessageHandling.MessageAttributes.MessageAttributes() -> void +JustSaying.Messaging.MessageHandling.MessageAttributes.MessageAttributes(System.Collections.Generic.Dictionary attributes) -> void +JustSaying.Messaging.MessageHandling.MessageContext +JustSaying.Messaging.MessageHandling.MessageContext.Message.get -> Amazon.SQS.Model.Message +JustSaying.Messaging.MessageHandling.MessageContext.MessageAttributes.get -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageHandling.MessageContext.MessageContext(Amazon.SQS.Model.Message message, System.Uri queueUri, JustSaying.Messaging.MessageHandling.MessageAttributes messageAttributes) -> void +JustSaying.Messaging.MessageHandling.MessageContext.QueueUri.get -> System.Uri +JustSaying.Messaging.MessageHandling.MessageContextAccessor +JustSaying.Messaging.MessageHandling.MessageContextAccessor.MessageContext.get -> JustSaying.Messaging.MessageHandling.MessageContext +JustSaying.Messaging.MessageHandling.MessageContextAccessor.MessageContext.set -> void +JustSaying.Messaging.MessageHandling.MessageContextAccessor.MessageContextAccessor() -> void +JustSaying.Messaging.MessageHandling.MessageLockResponse +JustSaying.Messaging.MessageHandling.MessageLockResponse.DoIHaveExclusiveLock.get -> bool +JustSaying.Messaging.MessageHandling.MessageLockResponse.DoIHaveExclusiveLock.set -> void +JustSaying.Messaging.MessageHandling.MessageLockResponse.ExpiryAt.get -> System.DateTimeOffset +JustSaying.Messaging.MessageHandling.MessageLockResponse.ExpiryAt.set -> void +JustSaying.Messaging.MessageHandling.MessageLockResponse.ExpiryAtTicks.get -> long +JustSaying.Messaging.MessageHandling.MessageLockResponse.ExpiryAtTicks.set -> void +JustSaying.Messaging.MessageHandling.MessageLockResponse.IsMessagePermanentlyLocked.get -> bool +JustSaying.Messaging.MessageHandling.MessageLockResponse.IsMessagePermanentlyLocked.set -> void +JustSaying.Messaging.MessageHandling.MessageLockResponse.MessageLockResponse() -> void +JustSaying.Messaging.MessageProcessingStrategies.IMessageBackoffStrategy +JustSaying.Messaging.MessageProcessingStrategies.IMessageBackoffStrategy.GetBackoffDuration(JustSaying.Models.Message message, int approximateReceiveCount, System.Exception lastException = null) -> System.TimeSpan +JustSaying.Messaging.MessageProcessingStrategies.MessageDefaults +JustSaying.Messaging.MessagePublisherExtensions +JustSaying.Messaging.MessageSerialization.GenericMessageSubjectProvider +JustSaying.Messaging.MessageSerialization.GenericMessageSubjectProvider.GenericMessageSubjectProvider() -> void +JustSaying.Messaging.MessageSerialization.GenericMessageSubjectProvider.GetSubjectForType(System.Type messageType) -> string +JustSaying.Messaging.MessageSerialization.IMessageSerializationFactory +JustSaying.Messaging.MessageSerialization.IMessageSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister +JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister.AddSerializer() -> void +JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister.DeserializeMessage(string body) -> JustSaying.Messaging.MessageSerialization.MessageWithAttributes +JustSaying.Messaging.MessageSerialization.IMessageSerializationRegister.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing) -> string +JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.IMessageSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.IMessageSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.IMessageSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.IMessageSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider +JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider.GetSubjectForType(System.Type messageType) -> string +JustSaying.Messaging.MessageSerialization.MessageFormatNotSupportedException +JustSaying.Messaging.MessageSerialization.MessageFormatNotSupportedException.MessageFormatNotSupportedException() -> void +JustSaying.Messaging.MessageSerialization.MessageFormatNotSupportedException.MessageFormatNotSupportedException(string message) -> void +JustSaying.Messaging.MessageSerialization.MessageFormatNotSupportedException.MessageFormatNotSupportedException(string message, System.Exception innerException) -> void +JustSaying.Messaging.MessageSerialization.MessageSerializationRegister +JustSaying.Messaging.MessageSerialization.MessageSerializationRegister.AddSerializer() -> void +JustSaying.Messaging.MessageSerialization.MessageSerializationRegister.DeserializeMessage(string body) -> JustSaying.Messaging.MessageSerialization.MessageWithAttributes +JustSaying.Messaging.MessageSerialization.MessageSerializationRegister.MessageSerializationRegister(JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider messageSubjectProvider, JustSaying.Messaging.MessageSerialization.IMessageSerializationFactory serializationFactory) -> void +JustSaying.Messaging.MessageSerialization.MessageSerializationRegister.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing) -> string +JustSaying.Messaging.MessageSerialization.MessageWithAttributes +JustSaying.Messaging.MessageSerialization.MessageWithAttributes.Message.get -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.MessageWithAttributes.MessageAttributes.get -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.MessageWithAttributes.MessageWithAttributes(JustSaying.Models.Message message, JustSaying.Messaging.MessageHandling.MessageAttributes messageAttributes) -> void +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializationFactory +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializationFactory.NewtonsoftSerializationFactory() -> void +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializationFactory.NewtonsoftSerializationFactory(Newtonsoft.Json.JsonSerializerSettings settings) -> void +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.NewtonsoftSerializer() -> void +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.NewtonsoftSerializer(Newtonsoft.Json.JsonSerializerSettings settings) -> void +JustSaying.Messaging.MessageSerialization.NewtonsoftSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.NonGenericMessageSubjectProvider +JustSaying.Messaging.MessageSerialization.NonGenericMessageSubjectProvider.GetSubjectForType(System.Type messageType) -> string +JustSaying.Messaging.MessageSerialization.NonGenericMessageSubjectProvider.NonGenericMessageSubjectProvider() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializationFactory +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializationFactory.SystemTextJsonSerializationFactory() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializationFactory.SystemTextJsonSerializationFactory(System.Text.Json.JsonSerializerOptions options) -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void +JustSaying.Messaging.MessageSerialization.TypeSerializer +JustSaying.Messaging.MessageSerialization.TypeSerializer.Serializer.get -> JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.TypeSerializer.Type.get -> System.Type +JustSaying.Messaging.MessageSerialization.TypeSerializer.TypeSerializer(System.Type type, JustSaying.Messaging.MessageSerialization.IMessageSerializer serializer) -> void +JustSaying.Messaging.Middleware.Backoff.BackoffMiddleware +JustSaying.Messaging.Middleware.Backoff.BackoffMiddleware.BackoffMiddleware(JustSaying.Messaging.MessageProcessingStrategies.IMessageBackoffStrategy backoffStrategy, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, JustSaying.Messaging.Monitoring.IMessageMonitor monitor) -> void +JustSaying.Messaging.Middleware.Backoff.BackoffMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.ErrorHandling.ErrorHandlerMiddleware +JustSaying.Messaging.Middleware.ErrorHandling.ErrorHandlerMiddleware.ErrorHandlerMiddleware(JustSaying.Messaging.Monitoring.IMessageMonitor monitor) -> void +JustSaying.Messaging.Middleware.ErrorHandling.ErrorHandlerMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.ExactlyOnceHandlerMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.ExactlyOnceMiddleware +JustSaying.Messaging.Middleware.ExactlyOnceMiddleware.ExactlyOnceMiddleware(JustSaying.Messaging.MessageHandling.IMessageLockAsync messageLock, System.TimeSpan timeout, string handlerName, Microsoft.Extensions.Logging.ILogger logger) -> void +JustSaying.Messaging.Middleware.HandleMessageContext +JustSaying.Messaging.Middleware.HandleMessageContext.HandledException.get -> System.Exception +JustSaying.Messaging.Middleware.HandleMessageContext.HandleMessageContext(string queueName, Amazon.SQS.Model.Message rawMessage, JustSaying.Models.Message message, System.Type messageType, JustSaying.Messaging.Channels.Context.IMessageVisibilityUpdater visibilityUpdater, JustSaying.Messaging.Channels.Context.IMessageDeleter messageDeleter, System.Uri queueUri, JustSaying.Messaging.MessageHandling.MessageAttributes messageAttributes) -> void +JustSaying.Messaging.Middleware.HandleMessageContext.Message.get -> JustSaying.Models.Message +JustSaying.Messaging.Middleware.HandleMessageContext.MessageAttributes.get -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.Middleware.HandleMessageContext.MessageDeleter.get -> JustSaying.Messaging.Channels.Context.IMessageDeleter +JustSaying.Messaging.Middleware.HandleMessageContext.MessageType.get -> System.Type +JustSaying.Messaging.Middleware.HandleMessageContext.QueueName.get -> string +JustSaying.Messaging.Middleware.HandleMessageContext.QueueUri.get -> System.Uri +JustSaying.Messaging.Middleware.HandleMessageContext.RawMessage.get -> Amazon.SQS.Model.Message +JustSaying.Messaging.Middleware.HandleMessageContext.SetException(System.Exception e) -> void +JustSaying.Messaging.Middleware.HandleMessageContext.VisibilityUpdater.get -> JustSaying.Messaging.Channels.Context.IMessageVisibilityUpdater +JustSaying.Messaging.Middleware.HandleMessageContextExtensions +JustSaying.Messaging.Middleware.HandlerInvocationMiddleware +JustSaying.Messaging.Middleware.HandlerInvocationMiddleware.HandlerInvocationMiddleware(System.Func> handlerResolver) -> void +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.Build() -> JustSaying.Messaging.Middleware.MiddlewareBase +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.Configure(System.Action configure) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.HandlerMiddlewareBuilder(JustSaying.IHandlerResolver handlerResolver, JustSaying.Fluent.IServiceResolver serviceResolver) -> void +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.Use(JustSaying.Messaging.Middleware.MiddlewareBase middleware) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.Use(System.Func> middlewareFactory) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.Use() -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder.UseHandler() -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +JustSaying.Messaging.Middleware.HandlerMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.Logging.LoggingMiddleware +JustSaying.Messaging.Middleware.Logging.LoggingMiddleware.LoggingMiddleware(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) -> void +JustSaying.Messaging.Middleware.MessageContext.MessageContextAccessorMiddleware +JustSaying.Messaging.Middleware.MessageContext.MessageContextAccessorMiddleware.MessageContextAccessorMiddleware(JustSaying.Messaging.MessageHandling.IMessageContextAccessor messageContextAccessor) -> void +JustSaying.Messaging.Middleware.MessageContext.MessageContextMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.MetricsMiddlewareBuilderExtensions +JustSaying.Messaging.Middleware.MiddlewareBase +JustSaying.Messaging.Middleware.MiddlewareBase.MiddlewareBase() -> void +JustSaying.Messaging.Middleware.MiddlewareBase.RunAsync(TContext context, System.Func> func, System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +JustSaying.Messaging.Middleware.MiddlewareBase.WithNext(JustSaying.Messaging.Middleware.MiddlewareBase next) -> JustSaying.Messaging.Middleware.MiddlewareBase +JustSaying.Messaging.Middleware.MiddlewareBuilder +JustSaying.Messaging.Middleware.PostProcessing.SqsPostProcessorMiddleware +JustSaying.Messaging.Middleware.PostProcessing.SqsPostProcessorMiddleware.SqsPostProcessorMiddleware() -> void +JustSaying.Messaging.Middleware.Receive.DefaultReceiveMessagesMiddleware +JustSaying.Messaging.Middleware.Receive.DefaultReceiveMessagesMiddleware.DefaultReceiveMessagesMiddleware(Microsoft.Extensions.Logging.ILogger logger) -> void +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.Count.get -> int +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.Count.set -> void +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.QueueName.get -> string +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.QueueName.set -> void +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.ReceiveMessagesContext() -> void +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.RegionName.get -> string +JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext.RegionName.set -> void +JustSaying.Messaging.Middleware.StopwatchMiddleware +JustSaying.Messaging.Middleware.StopwatchMiddleware.StopwatchMiddleware(JustSaying.Messaging.Monitoring.IMessageMonitor monitor, System.Type handlerType) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor +JustSaying.Messaging.Monitoring.IMessageMonitor.Handled(JustSaying.Models.Message message) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.HandleError(System.Exception ex, Amazon.SQS.Model.Message message) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.HandleException(System.Type messageType) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.HandlerExecutionTime(System.Type handlerType, System.Type messageType, System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.HandleThrottlingTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.HandleTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.IncrementThrottlingStatistic() -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.IssuePublishingMessage() -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.PublishMessageTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.IMessageMonitor.ReceiveMessageTime(System.TimeSpan duration, string queueName, string region) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.Handled(JustSaying.Models.Message message) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.HandleError(System.Exception ex, Amazon.SQS.Model.Message message) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.HandleException(System.Type messageType) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.HandlerExecutionTime(System.Type handlerType, System.Type messageType, System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.HandleThrottlingTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.HandleTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.IncrementThrottlingStatistic() -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.IssuePublishingMessage() -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.NullOpMessageMonitor() -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.PublishMessageTime(System.TimeSpan duration) -> void +JustSaying.Messaging.Monitoring.NullOpMessageMonitor.ReceiveMessageTime(System.TimeSpan duration, string queueName, string region) -> void +JustSaying.Messaging.PublishMetadata +JustSaying.Messaging.PublishMetadata.AddMessageAttribute(string key, double value) -> JustSaying.Messaging.PublishMetadata +JustSaying.Messaging.PublishMetadata.AddMessageAttribute(string key, JustSaying.Messaging.MessageAttributeValue value) -> JustSaying.Messaging.PublishMetadata +JustSaying.Messaging.PublishMetadata.AddMessageAttribute(string key, string value) -> JustSaying.Messaging.PublishMetadata +JustSaying.Messaging.PublishMetadata.AddMessageAttribute(string key, System.Collections.Generic.IReadOnlyCollection data) -> JustSaying.Messaging.PublishMetadata +JustSaying.Messaging.PublishMetadata.Delay.get -> System.TimeSpan? +JustSaying.Messaging.PublishMetadata.Delay.set -> void +JustSaying.Messaging.PublishMetadata.MessageAttributes.get -> System.Collections.Generic.IDictionary +JustSaying.Messaging.PublishMetadata.PublishMetadata() -> void +JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.BuildClientFactory() -> JustSaying.AwsTools.IAwsClientFactory +JustSaying.MessagingBusBuilder.BuildPublisher() -> JustSaying.Messaging.IMessagePublisher +JustSaying.MessagingBusBuilder.BuildSubscribers() -> JustSaying.IMessagingBus +JustSaying.MessagingBusBuilder.Client(System.Action configure) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.Messaging(System.Action configure) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.MessagingBusBuilder() -> void +JustSaying.MessagingBusBuilder.Publications(System.Action configure) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.Services(System.Action configure) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.Subscriptions(System.Action configure) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingBusBuilder.WithServiceResolver(JustSaying.Fluent.IServiceResolver serviceResolver) -> JustSaying.MessagingBusBuilder +JustSaying.MessagingConfig +JustSaying.MessagingConfig.AdditionalSubscriberAccounts.get -> System.Collections.Generic.IReadOnlyCollection +JustSaying.MessagingConfig.AdditionalSubscriberAccounts.set -> void +JustSaying.MessagingConfig.MessageResponseLogger.get -> System.Action +JustSaying.MessagingConfig.MessageResponseLogger.set -> void +JustSaying.MessagingConfig.MessageSubjectProvider.get -> JustSaying.Messaging.MessageSerialization.IMessageSubjectProvider +JustSaying.MessagingConfig.MessageSubjectProvider.set -> void +JustSaying.MessagingConfig.MessagingConfig() -> void +JustSaying.MessagingConfig.PublishFailureBackoff.get -> System.TimeSpan +JustSaying.MessagingConfig.PublishFailureBackoff.set -> void +JustSaying.MessagingConfig.PublishFailureReAttempts.get -> int +JustSaying.MessagingConfig.PublishFailureReAttempts.set -> void +JustSaying.MessagingConfig.QueueNamingConvention.get -> JustSaying.Naming.IQueueNamingConvention +JustSaying.MessagingConfig.QueueNamingConvention.set -> void +JustSaying.MessagingConfig.Region.get -> string +JustSaying.MessagingConfig.Region.set -> void +JustSaying.MessagingConfig.TopicNamingConvention.get -> JustSaying.Naming.ITopicNamingConvention +JustSaying.MessagingConfig.TopicNamingConvention.set -> void +JustSaying.Naming.DefaultNamingConventions +JustSaying.Naming.DefaultNamingConventions.DefaultNamingConventions() -> void +JustSaying.Naming.IQueueNamingConvention +JustSaying.Naming.IQueueNamingConvention.QueueName() -> string +JustSaying.Naming.ITopicNamingConvention +JustSaying.Naming.ITopicNamingConvention.TopicName() -> string +JustSaying.Naming.NamingConventionExtensions +override JustSaying.AwsTools.ErrorQueue.GetCreateQueueAttributes(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig) -> System.Collections.Generic.Dictionary +override JustSaying.AwsTools.ErrorQueue.QueueNeedsUpdating(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig) -> bool +override JustSaying.AwsTools.ErrorQueue.UpdateQueueAttributeAsync(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +override JustSaying.AwsTools.MessageHandling.SqsQueueByName.CreateAsync(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig, int attempt = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +override JustSaying.AwsTools.MessageHandling.SqsQueueByName.DeleteAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +override JustSaying.AwsTools.MessageHandling.SqsQueueByName.GetCreateQueueAttributes(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig) -> System.Collections.Generic.Dictionary +override JustSaying.AwsTools.QueueCreation.RedrivePolicy.ToString() -> string +override JustSaying.AwsTools.QueueCreation.SqsReadConfiguration.OnValidating() -> void +override JustSaying.Messaging.MessageHandling.MessageLockResponse.ToString() -> string +override JustSaying.Messaging.Middleware.PostProcessing.SqsPostProcessorMiddleware.RunInnerAsync(JustSaying.Messaging.Middleware.HandleMessageContext context, System.Func> func, System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +override JustSaying.Messaging.Middleware.Receive.DefaultReceiveMessagesMiddleware.RunInnerAsync(JustSaying.Messaging.Middleware.Receive.ReceiveMessagesContext context, System.Func>> func, System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task> +static JustSaying.AwsTools.JustSayingConstants.DefaultAttributeEncryptionKeyReusePeriod.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.DefaultHandlerRetryCount.get -> int +static JustSaying.AwsTools.JustSayingConstants.DefaultPublisherRetryCount.get -> int +static JustSaying.AwsTools.JustSayingConstants.DefaultPublisherRetryInterval.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.DefaultRetentionPeriod.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.DefaultSnsAttributeEncryptionKeyId.get -> string +static JustSaying.AwsTools.JustSayingConstants.DefaultSqsAttributeEncryptionKeyId.get -> string +static JustSaying.AwsTools.JustSayingConstants.DefaultVisibilityTimeout.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.MaximumDeliveryDelay.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.MaximumRetentionPeriod.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.MinimumDeliveryDelay.get -> System.TimeSpan +static JustSaying.AwsTools.JustSayingConstants.MinimumRetentionPeriod.get -> System.TimeSpan +static JustSaying.AwsTools.QueueCreation.RedrivePolicy.ConvertFromString(string policy) -> JustSaying.AwsTools.QueueCreation.RedrivePolicy +static JustSaying.Extensions.ChannelExtensions.MergeAsync(System.Collections.Generic.IEnumerable> inputs, System.Threading.Channels.ChannelWriter output, System.Threading.CancellationToken stoppingToken) -> System.Threading.Tasks.Task +static JustSaying.Messaging.Channels.SubscriptionGroups.SubscriptionGroupSettingsValidation.Validate(this JustSaying.Messaging.Channels.SubscriptionGroups.ISubscriptionGroupSettings settings) -> void +static JustSaying.Messaging.MessageProcessingStrategies.MessageDefaults.MaxAmazonMessageCap.get -> int +static JustSaying.Messaging.MessageProcessingStrategies.MessageDefaults.ParallelHandlerExecutionPerCore.get -> int +static JustSaying.Messaging.MessagePublisherExtensions.PublishAsync(this JustSaying.Messaging.IMessagePublisher publisher, JustSaying.Models.Message message) -> System.Threading.Tasks.Task +static JustSaying.Messaging.MessagePublisherExtensions.PublishAsync(this JustSaying.Messaging.IMessagePublisher publisher, JustSaying.Models.Message message, JustSaying.Messaging.PublishMetadata metadata) -> System.Threading.Tasks.Task +static JustSaying.Messaging.MessagePublisherExtensions.PublishAsync(this JustSaying.Messaging.IMessagePublisher publisher, JustSaying.Models.Message message, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +static JustSaying.Messaging.Middleware.Backoff.BackoffMiddlewareBuilderExtensions.UseBackoff(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder, JustSaying.Messaging.MessageProcessingStrategies.IMessageBackoffStrategy backoffStrategy) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.ErrorHandling.ErrorHandlerMiddlewareBuilderExtensions.UseErrorHandler(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.ExactlyOnceHandlerMiddlewareBuilderExtensions.UseExactlyOnce(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder, string lockKey, System.TimeSpan? lockDuration = null) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.HandleMessageContextExtensions.MessageAs(this JustSaying.Messaging.Middleware.HandleMessageContext context) -> TMessage +static JustSaying.Messaging.Middleware.HandlerMiddlewareBuilderExtensions.UseDefaults(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder, System.Type handlerType) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.HandlerMiddlewareBuilderExtensions.UseHandler(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder, System.Func> handler) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.MessageContext.MessageContextMiddlewareBuilderExtensions.UseMessageContextAccessor(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.MetricsMiddlewareBuilderExtensions.UseStopwatch(this JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder builder, System.Type handlerType) -> JustSaying.Messaging.Middleware.HandlerMiddlewareBuilder +static JustSaying.Messaging.Middleware.MiddlewareBuilder.BuildAsync(params JustSaying.Messaging.Middleware.MiddlewareBase[] middleware) -> JustSaying.Messaging.Middleware.MiddlewareBase +static JustSaying.Messaging.Middleware.MiddlewareBuilder.WithAsync(this JustSaying.Messaging.Middleware.MiddlewareBase inner, params JustSaying.Messaging.Middleware.MiddlewareBase[] middleware) -> JustSaying.Messaging.Middleware.MiddlewareBase +static JustSaying.Naming.NamingConventionExtensions.Apply(this JustSaying.Naming.IQueueNamingConvention namingConvention, string overrideQueueName) -> string +static JustSaying.Naming.NamingConventionExtensions.Apply(this JustSaying.Naming.ITopicNamingConvention namingConvention, string overrideTopicName) -> string +virtual JustSaying.AwsTools.DefaultAwsClientFactory.Configure(Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceConfig config) -> void +virtual JustSaying.AwsTools.DefaultAwsClientFactory.Configure(Amazon.SQS.AmazonSQSConfig config) -> void +virtual JustSaying.AwsTools.MessageHandling.SnsMessagePublisher.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.CreateAsync(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig, int attempt = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.DeleteAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.ExistsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.Interrogate() -> JustSaying.Messaging.Interrogation.InterrogationResult +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.QueueNeedsUpdating(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig) -> bool +virtual JustSaying.AwsTools.MessageHandling.SqsQueueByNameBase.UpdateQueueAttributeAsync(JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration queueConfig, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual JustSaying.AwsTools.QueueCreation.SqsBasicConfiguration.OnValidating() -> void +virtual JustSaying.MessagingConfig.Validate() -> void +virtual JustSaying.Naming.DefaultNamingConventions.QueueName() -> string +virtual JustSaying.Naming.DefaultNamingConventions.TopicName() -> string diff --git a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..bec18b9c4 --- /dev/null +++ b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -0,0 +1,10 @@ +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void +JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory +JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer +JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.TypedSystemTextJsonSerializationFactory(System.Text.Json.JsonSerializerOptions options) -> void From 0a7db70ef6721c9be46e2eba1cc9cd2f1a48c4fd Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sat, 17 Feb 2024 12:31:55 +0000 Subject: [PATCH 02/18] Get AoT working This commit gets AoT working to the point that I can actually test it, and see it work AOT locally --- Directory.Packages.props | 5 +++-- .../ApplicationJsonContext.cs | 1 + ...Saying.Sample.Restaurant.OrderingApi.csproj | 2 +- .../JustSayingHostedService.cs | 18 ------------------ .../OrderingApi.http | 2 +- .../Program.cs | 9 +++++++-- .../appsettings.json | 2 +- .../IServiceCollectionExtensions.cs | 10 +++++++--- ...nsions.DependencyInjection.Microsoft.csproj | 3 ++- .../AwsTools/QueueCreation/RedrivePolicy.cs | 15 ++++++++++++--- .../JsonSerializerOptionsExtensions.cs | 5 +++++ .../Fluent/AccountAddressProvider.cs | 4 +++- src/JustSaying/Fluent/QueueAddress.cs | 4 +++- src/JustSaying/JustSaying.csproj | 4 ++-- src/JustSaying/JustSayingBus.cs | 2 +- .../JustSayingSerializationContext.cs | 5 ++++- .../SystemTextJsonSerializer`1.cs | 2 +- 17 files changed, 54 insertions(+), 39 deletions(-) delete mode 100644 samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs rename src/JustSaying/{Messaging/MessageSerialization => }/JustSayingSerializationContext.cs (62%) diff --git a/Directory.Packages.props b/Directory.Packages.props index 74e19cbd8..40a3f6efc 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,14 +1,15 @@ - - + + + diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs index 26763525c..a6f3cf90b 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/ApplicationJsonContext.cs @@ -5,6 +5,7 @@ namespace JustSaying.Sample.Restaurant.OrderingApi; [JsonSerializable(typeof(CustomerOrderModel))] +[JsonSerializable(typeof(OrderPlacedEvent))] [JsonSerializable(typeof(OrderReadyEvent))] [JsonSerializable(typeof(OrderDeliveredEvent))] [JsonSerializable(typeof(OrderOnItsWayEvent))] diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj index 773df8f61..6e7d7aac0 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSaying.Sample.Restaurant.OrderingApi.csproj @@ -21,7 +21,7 @@ - + diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs deleted file mode 100644 index ba7fd0329..000000000 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/JustSayingHostedService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JustSaying.Messaging; - -namespace JustSaying.Sample.Restaurant.OrderingApi; - -public sealed class JustSayingHostedService(IMessagingBus bus, IMessagePublisher publisher) : BackgroundService -{ - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - try - { - await Task.WhenAll(publisher.StartAsync(stoppingToken), bus.StartAsync(stoppingToken)); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - } -} diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http index a5d907730..31a602bc4 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/OrderingApi.http @@ -1,4 +1,4 @@ -@HostAddress = https://localhost:5001 +@HostAddress = http://localhost:5001 POST {{HostAddress}}/api/orders Content-Type: application/json diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index 1eede8dff..0c20388d4 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -1,5 +1,6 @@ using System.Text.Json; using JustSaying.Messaging; +using JustSaying.Messaging.MessageSerialization; using JustSaying.Sample.Restaurant.Models; using JustSaying.Sample.Restaurant.OrderingApi; using JustSaying.Sample.Restaurant.OrderingApi.Handlers; @@ -29,8 +30,12 @@ { cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); - builder.Services.AddHostedService(); - builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); + + builder.Services.Configure(cfg => + { + cfg.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); + }); + builder.Services.AddJustSaying(config => { config.Client(x => diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/appsettings.json b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/appsettings.json index ad029c003..ef0bee20f 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/appsettings.json +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/appsettings.json @@ -1,5 +1,5 @@ { "AWSRegion": "eu-west-1", - "AWSServiceUrl": "http://localhost:4100", + "AWSServiceUrl": "http://localhost:4566", "AllowedHosts": "*" } diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index 51f389500..c9c0fddf6 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using JustSaying; using JustSaying.AwsTools; using JustSaying.AwsTools.QueueCreation; @@ -13,6 +12,11 @@ using JustSaying.Models; using JustSaying.Naming; using Microsoft.Extensions.DependencyInjection.Extensions; +#if NET8_0_OR_GREATER +using System.Text.Json; +using Microsoft.Extensions.Options; +using System.Diagnostics.CodeAnalysis; +#endif namespace Microsoft.Extensions.DependencyInjection; @@ -62,7 +66,7 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, if (string.IsNullOrWhiteSpace(region)) { - throw new ArgumentException("region must not be null or empty" ,nameof(region)); + throw new ArgumentException("region must not be null or empty", nameof(region)); } return services.AddJustSaying( @@ -137,7 +141,7 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); #if NET8_0_OR_GREATER - services.TryAddSingleton(); + services.TryAddSingleton(sp => new TypedSystemTextJsonSerializationFactory(sp.GetRequiredService>().Value)); #else services.TryAddSingleton(); #endif diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj b/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj index 21516d6d4..1564ea1aa 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/JustSaying.Extensions.DependencyInjection.Microsoft.csproj @@ -11,11 +11,12 @@ + - + true diff --git a/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs b/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs index ea6b1af25..c9a584962 100644 --- a/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs +++ b/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs @@ -13,6 +13,9 @@ public class RedrivePolicy [JsonPropertyName("deadLetterTargetArn")] public string DeadLetterQueue { get; set; } +#if NET8_0_OR_GREATER + [System.Text.Json.Serialization.JsonConstructor] +#endif public RedrivePolicy(int maximumReceives, string deadLetterQueue) { MaximumReceives = maximumReceives; @@ -23,11 +26,17 @@ protected RedrivePolicy() { } - // Cannot use System.Text.Json below as no public parameterless constructor. Change for v7? - public override string ToString() +#if NET8_0_OR_GREATER + => System.Text.Json.JsonSerializer.Serialize(this, JustSayingSerializationContext.Default.RedrivePolicy); +#else => JsonConvert.SerializeObject(this); +#endif public static RedrivePolicy ConvertFromString(string policy) +#if NET8_0_OR_GREATER + => System.Text.Json.JsonSerializer.Deserialize(policy, JustSayingSerializationContext.Default.RedrivePolicy); +#else => JsonConvert.DeserializeObject(policy); -} \ No newline at end of file +#endif +} diff --git a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs index b9779d98a..37cd836c8 100644 --- a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs +++ b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs @@ -9,6 +9,11 @@ internal static class JsonSerializerOptionsExtensions { public static JsonTypeInfo GetTypeInfo(this JsonSerializerOptions options) { + foreach (var info in options.TypeInfoResolverChain) + { + Console.WriteLine(info); + } + var typeInfo = options.GetTypeInfo(typeof(T)); if (typeInfo is not JsonTypeInfo genericTypeInfo) { diff --git a/src/JustSaying/Fluent/AccountAddressProvider.cs b/src/JustSaying/Fluent/AccountAddressProvider.cs index 14dbec3ea..e6622767f 100644 --- a/src/JustSaying/Fluent/AccountAddressProvider.cs +++ b/src/JustSaying/Fluent/AccountAddressProvider.cs @@ -106,10 +106,12 @@ public Uri GetQueueUriByConvention() /// The for this queue. public Uri GetQueueUri(string queueName) { +#pragma warning disable CS0618 // Type or member is obsolete var hostname = _regionEndpoint.GetEndpointForService("sqs").Hostname; +#pragma warning restore CS0618 // Type or member is obsolete return new UriBuilder("https", hostname) { Path = $"{_accountId}/{queueName}" }.Uri; } -} \ No newline at end of file +} diff --git a/src/JustSaying/Fluent/QueueAddress.cs b/src/JustSaying/Fluent/QueueAddress.cs index 33b6ec08a..8b3ab01e2 100644 --- a/src/JustSaying/Fluent/QueueAddress.cs +++ b/src/JustSaying/Fluent/QueueAddress.cs @@ -79,9 +79,11 @@ public static QueueAddress FromArn(string queueArn) if (!Arn.TryParse(queueArn, out var arn)) throw new ArgumentException("Must be a valid ARN.", nameof(queueArn)); if (!string.Equals(arn.Service, "sqs", StringComparison.OrdinalIgnoreCase)) throw new ArgumentException("Must be an ARN for an SQS queue.", nameof(queueArn)); +#pragma warning disable CS0618 // Type or member is obsolete var hostname = RegionEndpoint.GetBySystemName(arn.Region) .GetEndpointForService("sqs") .Hostname; +#pragma warning restore CS0618 // Type or member is obsolete var queueUrl = new UriBuilder("https", hostname) { @@ -94,4 +96,4 @@ public static QueueAddress FromArn(string queueArn) RegionName = arn.Region }; } -} \ No newline at end of file +} diff --git a/src/JustSaying/JustSaying.csproj b/src/JustSaying/JustSaying.csproj index fb4cbf46c..066aca337 100644 --- a/src/JustSaying/JustSaying.csproj +++ b/src/JustSaying/JustSaying.csproj @@ -23,10 +23,10 @@ - + - + true diff --git a/src/JustSaying/JustSayingBus.cs b/src/JustSaying/JustSayingBus.cs index c5fbc347e..b19c6fd80 100644 --- a/src/JustSaying/JustSayingBus.cs +++ b/src/JustSaying/JustSayingBus.cs @@ -200,7 +200,7 @@ public async Task PublishAsync( { if (!_busStarted && _startupTasks.Count > 0) { - throw new InvalidOperationException("There are pending startup tasks that must be executed by calling StartAsync before messages may be published."); + throw new InvalidOperationException($"There are pending startup tasks that must be executed by calling StartAsync before messages may be published. Bus started {_busStarted}, Count {_startupTasks.Count}"); } IMessagePublisher publisher = GetPublisherForMessage(message); diff --git a/src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs b/src/JustSaying/JustSayingSerializationContext.cs similarity index 62% rename from src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs rename to src/JustSaying/JustSayingSerializationContext.cs index 4f840c709..3a0a6fb18 100644 --- a/src/JustSaying/Messaging/MessageSerialization/JustSayingSerializationContext.cs +++ b/src/JustSaying/JustSayingSerializationContext.cs @@ -1,9 +1,12 @@ #if NET8_0_OR_GREATER using System.Text.Json.Serialization; +using JustSaying.AwsTools.QueueCreation; +using JustSaying.Messaging.MessageSerialization; -namespace JustSaying.Messaging.MessageSerialization; +namespace JustSaying; [JsonSerializable(typeof(SqsMessageEnvelope))] [JsonSerializable(typeof(IReadOnlyCollection))] +[JsonSerializable(typeof(RedrivePolicy))] internal sealed partial class JustSayingSerializationContext : JsonSerializerContext; #endif diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs index 57add010f..d3d3a556b 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs @@ -113,7 +113,7 @@ public string Serialize(Message message, bool serializeForSnsPublishing, string // For direct publishing to SQS, add Subject and Message properties manually var context = new SqsMessageEnvelope { Subject = subject, Message = json }; - return JsonSerializer.Serialize(context, JustSayingSerializationContext.Default.SqsMessageEnvelope); + return JsonSerializer.Serialize(context, JustSaying.JustSayingSerializationContext.Default.SqsMessageEnvelope); } } #endif From 74ed1f0d8de359ce039ef56fb80c47fe28e5dad8 Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sat, 17 Feb 2024 12:43:40 +0000 Subject: [PATCH 03/18] Fix inverted DynamicCodeSupported check --- src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs index 43fdc7940..ad2337c66 100644 --- a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs +++ b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs @@ -47,7 +47,7 @@ private object TryResolveService(Type desiredType) { #if NET8_0_OR_GREATER - if (!RuntimeFeature.IsDynamicCodeSupported) + if (RuntimeFeature.IsDynamicCodeSupported) { #pragma warning disable IL2026 #pragma warning disable IL3050 From 68d150e1e29649bc0625efcb96e58fbec579f9de Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sat, 17 Feb 2024 17:25:26 +0000 Subject: [PATCH 04/18] Some changes per review (Pushing rather than stashing) --- Directory.Build.props | 6 ++++++ .../Program.cs | 4 ++-- .../IServiceCollectionExtensions.cs | 2 +- src/JustSaying/JustSaying.csproj | 6 ------ .../JustSayingJsonSerializerOptions.cs | 10 ++++++++++ .../TypedSystemTextJsonSerializationFactory.cs | 5 ++--- .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 5 ++++- 7 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs diff --git a/Directory.Build.props b/Directory.Build.props index 15004a4f8..6fe9d2dac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -64,4 +64,10 @@ + + + + + true + diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index 0c20388d4..070cc4adf 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -31,9 +31,9 @@ cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); - builder.Services.Configure(cfg => + builder.Services.Configure(cfg => { - cfg.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); + cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); builder.Services.AddJustSaying(config => diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index c9c0fddf6..256224c6d 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -141,7 +141,7 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); #if NET8_0_OR_GREATER - services.TryAddSingleton(sp => new TypedSystemTextJsonSerializationFactory(sp.GetRequiredService>().Value)); + services.TryAddSingleton(sp => new TypedSystemTextJsonSerializationFactory(sp.GetRequiredService>().Value)); #else services.TryAddSingleton(); #endif diff --git a/src/JustSaying/JustSaying.csproj b/src/JustSaying/JustSaying.csproj index 066aca337..edbd7e93b 100644 --- a/src/JustSaying/JustSaying.csproj +++ b/src/JustSaying/JustSaying.csproj @@ -23,10 +23,4 @@ - - - - - true - diff --git a/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs b/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs new file mode 100644 index 000000000..f113e9900 --- /dev/null +++ b/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs @@ -0,0 +1,10 @@ +#if NET8_0_OR_GREATER +using System.Text.Json; + +namespace JustSaying.Messaging.MessageSerialization; + +public class JustSayingJsonSerializerOptions +{ + public JsonSerializerOptions SerializerOptions { get; } = new(); +} +#endif diff --git a/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs index e4edbacdf..1473d5707 100644 --- a/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs +++ b/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs @@ -1,11 +1,10 @@ #if NET8_0_OR_GREATER -using System.Text.Json; using JustSaying.Models; namespace JustSaying.Messaging.MessageSerialization; -public class TypedSystemTextJsonSerializationFactory(JsonSerializerOptions options) : IMessageSerializationFactory +public class TypedSystemTextJsonSerializationFactory(JustSayingJsonSerializerOptions options) : IMessageSerializationFactory { - public IMessageSerializer GetSerializer() where T : Message => new SystemTextJsonSerializer(options); + public IMessageSerializer GetSerializer() where T : Message => new SystemTextJsonSerializer(options.SerializerOptions); } #endif diff --git a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt index bec18b9c4..825abc8bc 100644 --- a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt +++ b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -1,3 +1,6 @@ +JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions +JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions.JustSayingJsonSerializerOptions() -> void +JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions.SerializerOptions.get -> System.Text.Json.JsonSerializerOptions JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes @@ -7,4 +10,4 @@ JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemText JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer -JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.TypedSystemTextJsonSerializationFactory(System.Text.Json.JsonSerializerOptions options) -> void +JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.TypedSystemTextJsonSerializationFactory(JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions options) -> void From 0f4cb434424f2e2be40e1194a41dbe52458ea6be Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Tue, 20 Feb 2024 15:05:55 +0000 Subject: [PATCH 05/18] Fix merge issue --- .../MessageSerialization/MessageFormatNotSupportedException.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs b/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs index 8133c6a4b..4c6f258e0 100644 --- a/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs +++ b/src/JustSaying/Messaging/MessageSerialization/MessageFormatNotSupportedException.cs @@ -22,7 +22,6 @@ public MessageFormatNotSupportedException(string message, Exception innerExcepti } #if !NET8_0_OR_GREATER -#if !NET8_0_OR_GREATER protected MessageFormatNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } From 61aa17254c7c20027cfc1795f361ff6fee9bc937 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Thu, 22 Feb 2024 09:37:36 +0000 Subject: [PATCH 06/18] Add unreferenced code annotations to JS.E.AWS --- .../IServiceCollectionExtensions.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/JustSaying.Extensions.Aws/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.Aws/IServiceCollectionExtensions.cs index 4bd56e542..4f1724cfb 100644 --- a/src/JustSaying.Extensions.Aws/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.Aws/IServiceCollectionExtensions.cs @@ -15,6 +15,8 @@ namespace Microsoft.Extensions.DependencyInjection; [EditorBrowsable(EditorBrowsableState.Never)] public static class IServiceCollectionExtensions { + private const string AttributeRequiresUnreferencedCodeMessage = "The AWSSDK.Extensions.NETCore.Setup package has not been updated to support Native AOT compilations"; + /// /// Adds JustSaying services to the service collection using AWS configuration. /// @@ -27,6 +29,9 @@ public static class IServiceCollectionExtensions /// /// , or is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(AttributeRequiresUnreferencedCodeMessage)] +#endif public static void AddJustSayingWithAwsConfig(this IServiceCollection services, IConfiguration configuration, Action builderConfig) { if (services is null) @@ -59,6 +64,9 @@ public static void AddJustSayingWithAwsConfig(this IServiceCollection services, /// /// , or is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(AttributeRequiresUnreferencedCodeMessage)] +#endif public static void AddJustSayingWithAwsConfig(this IServiceCollection services, IConfiguration configuration, Action builderConfig) { if (services is null) From f05572c420a9e09e32e703aa4fe9c5a14ed0ae37 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Thu, 22 Feb 2024 10:21:42 +0000 Subject: [PATCH 07/18] WIP: Some restructuring to make usage a little more seamless, and reduce API change --- .../IServiceCollectionExtensions.cs | 2 +- src/JustSaying/Constants.cs | 4 +- .../JsonSerializerOptionsExtensions.cs | 13 +--- .../ServiceResolver/DefaultServiceResolver.cs | 9 ++- .../SystemTextJsonSerializationFactory.cs | 22 ++++-- .../SystemTextJsonSerializer.cs | 3 +- .../SystemTextJsonSerializer`1.cs | 76 ++++++++++++++++--- ...TypedSystemTextJsonSerializationFactory.cs | 10 --- .../PublicAPI/net461/PublicAPI.Unshipped.txt | 7 ++ .../netstandard2.0/PublicAPI.Unshipped.txt | 7 ++ ...alingWithPotentiallyMissingConversation.cs | 4 +- .../WhenSerializingAndDeserializing.cs | 4 +- .../SystemTextJson/WhenUsingCustomSettings.cs | 4 +- 13 files changed, 119 insertions(+), 46 deletions(-) delete mode 100644 src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index 256224c6d..d803e7ca9 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -141,7 +141,7 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); #if NET8_0_OR_GREATER - services.TryAddSingleton(sp => new TypedSystemTextJsonSerializationFactory(sp.GetRequiredService>().Value)); + services.TryAddSingleton(sp => new SystemTextJsonSerializationFactory()); #else services.TryAddSingleton(); #endif diff --git a/src/JustSaying/Constants.cs b/src/JustSaying/Constants.cs index de2f4236a..1e8683ba1 100644 --- a/src/JustSaying/Constants.cs +++ b/src/JustSaying/Constants.cs @@ -2,6 +2,6 @@ internal static class Constants { - internal const string SerializationUnreferencedCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved."; - internal const string SerializationDynamicCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext."; + internal const string SerializationUnreferencedCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the generic SystemTextJsonSerializer."; + internal const string SerializationDynamicCodeMessage = "JSON serialization and deserialization might require types that cannot be statically analyzed. Use the generic SystemTextJsonSerializer."; } diff --git a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs index 37cd836c8..427bc6662 100644 --- a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs +++ b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs @@ -9,18 +9,9 @@ internal static class JsonSerializerOptionsExtensions { public static JsonTypeInfo GetTypeInfo(this JsonSerializerOptions options) { - foreach (var info in options.TypeInfoResolverChain) - { - Console.WriteLine(info); - } - + // This is not guarded as we want to throw if the desired type has not been configured for var typeInfo = options.GetTypeInfo(typeof(T)); - if (typeInfo is not JsonTypeInfo genericTypeInfo) - { - throw new JsonException($"Could not find type info for the specified type {typeof(T).Name}"); - } - - return genericTypeInfo; + return (JsonTypeInfo)typeInfo; } } #endif diff --git a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs index ad2337c66..80ec759e7 100644 --- a/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs +++ b/src/JustSaying/Fluent/ServiceResolver/DefaultServiceResolver.cs @@ -49,14 +49,15 @@ private object TryResolveService(Type desiredType) #if NET8_0_OR_GREATER if (RuntimeFeature.IsDynamicCodeSupported) { - #pragma warning disable IL2026 - #pragma warning disable IL3050 +#pragma warning disable IL2026 +#pragma warning disable IL3050 return new NewtonsoftSerializationFactory(); - #pragma warning restore +#pragma warning restore IL2026 +#pragma warning disable IL3050 } else { - throw new NotSupportedException($"Newtonsoft.Json is not supported when compiled with the 'PublishTrimmed' option. Use {nameof(TypedSystemTextJsonSerializationFactory)} instead."); + throw new NotSupportedException($"Newtonsoft.Json is not supported when compiled with the 'PublishTrimmed' option. Use {nameof(SystemTextJsonSerializationFactory)} instead."); } #else return new NewtonsoftSerializationFactory(); diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs index 47db48e1c..3a4326f89 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializationFactory.cs @@ -1,20 +1,32 @@ using System.Text.Json; using JustSaying.Models; +#if NET8_0_OR_GREATER +using System.Runtime.CompilerServices; +#endif namespace JustSaying.Messaging.MessageSerialization; -#if NET8_0_OR_GREATER -[RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] -[RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] -#endif public class SystemTextJsonSerializationFactory(JsonSerializerOptions options) : IMessageSerializationFactory { +#pragma warning disable CS0618 // Keep using obsolete serializer for now until the next breaking version +#pragma warning disable IL2026 // Not used in contexts where dynamic code is not supported +#pragma warning disable IL3050 private readonly SystemTextJsonSerializer _serializer = new(options); +#pragma warning restore IL3050 +#pragma warning restore IL2026 +#pragma warning restore CS0618 public SystemTextJsonSerializationFactory() : this(null) { } - public IMessageSerializer GetSerializer() where T : Message => _serializer; + public IMessageSerializer GetSerializer() where T : Message => +#if !NET8_0_OR_GREATER + _serializer; +#else + RuntimeFeature.IsDynamicCodeSupported + ? _serializer + : new SystemTextJsonSerializer(options); +#endif } diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs index 39a44f05a..48d776146 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs @@ -12,7 +12,8 @@ namespace JustSaying.Messaging.MessageSerialization; [RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] [RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] #endif -public partial class SystemTextJsonSerializer : IMessageSerializer +[Obsolete("This API is deprecated, and will be removed in a later version. Use SystemTextJsonSerializer instead.")] +public class SystemTextJsonSerializer : IMessageSerializer { private static readonly JsonSerializerOptions DefaultJsonSerializerOptions = new() { diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs index d3d3a556b..810cd3011 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs @@ -1,9 +1,11 @@ -#if NET8_0_OR_GREATER using System.Text.Json; using System.Text.Json.Serialization; -using JustSaying.Extensions; using JustSaying.Messaging.MessageHandling; using JustSaying.Models; +#if NET8_0_OR_GREATER +using System.Runtime.CompilerServices; +using JustSaying.Extensions; +#endif namespace JustSaying.Messaging.MessageSerialization; @@ -39,6 +41,17 @@ public SystemTextJsonSerializer(JsonSerializerOptions options) IgnoreNullValues = true, #endif }; + +#if NET8_0_OR_GREATER + if (RuntimeFeature.IsDynamicCodeSupported) + { +#pragma warning disable IL3050 + options.Converters.Add(new JsonStringEnumConverter()); +#pragma warning restore IL3050 + } +#else + options.Converters.Add(new JsonStringEnumConverter()); +#endif } _options = options; @@ -92,17 +105,14 @@ public Message Deserialize(string message, Type type) using var document = JsonDocument.Parse(message); JsonElement element = document.RootElement.GetProperty("Message"); string json = element.ToString(); - var jsonTypeInfo = _options.GetTypeInfo(); - return (Message)JsonSerializer.Deserialize(json, jsonTypeInfo); + return DeserializeCore(json, type); } /// public string Serialize(Message message, bool serializeForSnsPublishing, string subject) { - - var jsonTypeInfo = _options.GetTypeInfo(); - string json = JsonSerializer.Serialize(message, jsonTypeInfo); + string json = SerializeCore(message); // AWS SNS service will add Subject and Message properties automatically, // so just return plain message @@ -113,7 +123,55 @@ public string Serialize(Message message, bool serializeForSnsPublishing, string // For direct publishing to SQS, add Subject and Message properties manually var context = new SqsMessageEnvelope { Subject = subject, Message = json }; - return JsonSerializer.Serialize(context, JustSaying.JustSayingSerializationContext.Default.SqsMessageEnvelope); + +#if NET8_0_OR_GREATER + return JsonSerializer.Serialize(context, JustSayingSerializationContext.Default.SqsMessageEnvelope); +#else + return JsonSerializer.Serialize(context, _options); +#endif } -} + + private Message DeserializeCore(string json, Type type) + { +#if NET8_0_OR_GREATER + if (RuntimeFeature.IsDynamicCodeSupported) + { +#pragma warning disable IL3050 +#pragma warning disable IL2026 + return (Message)JsonSerializer.Deserialize(json, type, _options); +#pragma warning restore IL2026 +#pragma warning restore IL3050 + } + + var jsonTypeInfo = _options.GetTypeInfo(); + return JsonSerializer.Deserialize(json, jsonTypeInfo); +#else + return (Message)JsonSerializer.Deserialize(json, type, _options); +#endif + } + + private string SerializeCore(Message message) + { + string json = string.Empty; + +#if NET8_0_OR_GREATER + if (RuntimeFeature.IsDynamicCodeSupported) + { +#pragma warning disable IL3050 +#pragma warning disable IL2026 + json = JsonSerializer.Serialize(message, _options); +#pragma warning restore IL2026 +#pragma warning restore IL3050 + } + else + { + var jsonTypeInfo = _options.GetTypeInfo(); + json = JsonSerializer.Serialize(message, jsonTypeInfo); + } +#else + json = JsonSerializer.Serialize(message, _options); #endif + + return json; + } +} diff --git a/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs b/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs deleted file mode 100644 index 1473d5707..000000000 --- a/src/JustSaying/Messaging/MessageSerialization/TypedSystemTextJsonSerializationFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -#if NET8_0_OR_GREATER -using JustSaying.Models; - -namespace JustSaying.Messaging.MessageSerialization; - -public class TypedSystemTextJsonSerializationFactory(JustSayingJsonSerializerOptions options) : IMessageSerializationFactory -{ - public IMessageSerializer GetSerializer() where T : Message => new SystemTextJsonSerializer(options.SerializerOptions); -} -#endif diff --git a/src/JustSaying/PublicAPI/net461/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/net461/PublicAPI.Unshipped.txt index e69de29bb..d646a162a 100644 --- a/src/JustSaying/PublicAPI/net461/PublicAPI.Unshipped.txt +++ b/src/JustSaying/PublicAPI/net461/PublicAPI.Unshipped.txt @@ -0,0 +1,7 @@ +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void \ No newline at end of file diff --git a/src/JustSaying/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index e69de29bb..d646a162a 100644 --- a/src/JustSaying/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/JustSaying/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1,7 @@ +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageSubject(string sqsMessage) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer() -> void +JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void \ No newline at end of file diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/DealingWithPotentiallyMissingConversation.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/DealingWithPotentiallyMissingConversation.cs index 596dda031..68c1bc597 100644 --- a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/DealingWithPotentiallyMissingConversation.cs +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/DealingWithPotentiallyMissingConversation.cs @@ -3,7 +3,9 @@ namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson; +#pragma warning disable CS0618 // Type or member is obsolete public class DealingWithPotentiallyMissingConversation : XBehaviourTest +#pragma warning restore CS0618 // Type or member is obsolete { private MessageWithEnum _messageOut; private MessageWithEnum _messageIn; @@ -34,4 +36,4 @@ public void DeserializedMessageHasEmptyConversation_ThisIsForBackwardsCompatibil { _messageIn.Conversation.ShouldBeNull(); } -} \ No newline at end of file +} diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenSerializingAndDeserializing.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenSerializingAndDeserializing.cs index ed36f2232..d018690e9 100644 --- a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenSerializingAndDeserializing.cs +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenSerializingAndDeserializing.cs @@ -3,7 +3,9 @@ namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson; +#pragma warning disable CS0618 // Type or member is obsolete public class WhenSerializingAndDeserializing : XBehaviourTest +#pragma warning restore CS0618 // Type or member is obsolete { private MessageWithEnum _messageOut; private MessageWithEnum _messageIn; @@ -40,4 +42,4 @@ public void EnumsAreRepresentedAsStrings() _jsonMessage.ShouldContain("EnumVal"); _jsonMessage.ShouldContain("Two"); } -} \ No newline at end of file +} diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenUsingCustomSettings.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenUsingCustomSettings.cs index 7523c64e1..e148e3f36 100644 --- a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenUsingCustomSettings.cs +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson/WhenUsingCustomSettings.cs @@ -5,6 +5,7 @@ namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson; +#pragma warning disable CS0618 // Type or member is obsolete public class WhenUsingCustomSettings : XBehaviourTest { private MessageWithEnum _messageOut; @@ -43,4 +44,5 @@ public void EnumsAreNotRepresentedAsStrings() _jsonMessage.ShouldContain("EnumVal"); _jsonMessage.ShouldNotContain("Two"); } -} \ No newline at end of file +} +#pragma warning restore CS0618 From 773f7fce93c16005611f3e3efbc67e2fa8c74294 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Thu, 22 Feb 2024 19:39:18 +0000 Subject: [PATCH 08/18] Get message attributes more defensively --- .../Extensions/JsonElementExtensions.cs | 25 +++++++++++++++++++ .../SystemTextJsonSerializer`1.cs | 25 ++++++++++--------- 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 src/JustSaying/Extensions/JsonElementExtensions.cs diff --git a/src/JustSaying/Extensions/JsonElementExtensions.cs b/src/JustSaying/Extensions/JsonElementExtensions.cs new file mode 100644 index 000000000..a019280ac --- /dev/null +++ b/src/JustSaying/Extensions/JsonElementExtensions.cs @@ -0,0 +1,25 @@ +#nullable enable +using System.Text.Json; + +namespace JustSaying.Extensions; + +internal static class JsonElementExtensions +{ +#if NET8_0_OR_GREATER + public static bool TryGetStringProperty(this JsonElement element, string key, [NotNullWhen(true)] out string? value) +#else + public static bool TryGetStringProperty(this JsonElement element, string key, out string? value) +#endif + { + value = null; + if (element.TryGetProperty(key, out var property) + && property.ValueKind is JsonValueKind.String or JsonValueKind.Null + && property.GetString() is {} propertyValue) + { + value = propertyValue; + return true; + } + + return false; + } +} diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs index 810cd3011..a841185a9 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs @@ -1,10 +1,10 @@ using System.Text.Json; using System.Text.Json.Serialization; +using JustSaying.Extensions; using JustSaying.Messaging.MessageHandling; using JustSaying.Models; #if NET8_0_OR_GREATER using System.Runtime.CompilerServices; -using JustSaying.Extensions; #endif namespace JustSaying.Messaging.MessageSerialization; @@ -83,17 +83,18 @@ public MessageAttributes GetMessageAttributes(string message) var attributes = new Dictionary(); foreach(var obj in attributesElement.EnumerateObject()) { - var dataType = obj.Value.GetProperty("Type").GetString(); - var dataValue = obj.Value.GetProperty("Value").GetString(); - - var isString = dataType == "String"; - - attributes.Add(obj.Name, new MessageAttributeValue() + if (obj.Value.TryGetStringProperty("Type", out var dataType) + && obj.Value.TryGetStringProperty("Value", out var dataValue)) { - DataType = dataType, - StringValue = isString ? dataValue : null, - BinaryValue = !isString ? Convert.FromBase64String(dataValue) : null - }); + var isString = dataType == "String"; + + attributes.Add(obj.Name, new MessageAttributeValue() + { + DataType = dataType, + StringValue = isString ? dataValue : null, + BinaryValue = !isString ? Convert.FromBase64String(dataValue) : null + }); + } } return new MessageAttributes(attributes); @@ -152,7 +153,7 @@ private Message DeserializeCore(string json, Type type) private string SerializeCore(Message message) { - string json = string.Empty; + string json; #if NET8_0_OR_GREATER if (RuntimeFeature.IsDynamicCodeSupported) From 4334fe70035ed6d02815338ec05a3d46a8b9dac7 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Thu, 22 Feb 2024 19:39:48 +0000 Subject: [PATCH 09/18] Start undoing behavioural changes --- .../src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs | 3 +++ .../IServiceCollectionExtensions.cs | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index 070cc4adf..91e68d232 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -36,6 +36,9 @@ cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); + builder.Services.AddSingleton(sp => + new SystemTextJsonSerializationFactory(sp.GetRequiredService>().Value.SerializerOptions)); + builder.Services.AddJustSaying(config => { config.Client(x => diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index d803e7ca9..b05e1f30a 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -140,11 +140,8 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); services.TryAddSingleton(serviceProvider => serviceProvider.GetRequiredService()); -#if NET8_0_OR_GREATER - services.TryAddSingleton(sp => new SystemTextJsonSerializationFactory()); -#else services.TryAddSingleton(); -#endif + services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton( From ffa2d3172eed2e5454dcc21e0050fd6d8477c507 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Tue, 27 Feb 2024 23:36:30 +0000 Subject: [PATCH 10/18] Remove removed type from public API --- src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt index 825abc8bc..936be332b 100644 --- a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt +++ b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -8,6 +8,3 @@ JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessage JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Serialize(JustSaying.Models.Message message, bool serializeForSnsPublishing, string subject) -> string JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer() -> void JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.SystemTextJsonSerializer(System.Text.Json.JsonSerializerOptions options) -> void -JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory -JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.GetSerializer() -> JustSaying.Messaging.MessageSerialization.IMessageSerializer -JustSaying.Messaging.MessageSerialization.TypedSystemTextJsonSerializationFactory.TypedSystemTextJsonSerializationFactory(JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions options) -> void From 470e3feeb88f82222e379a1f09b78fbddf0034a3 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Tue, 27 Feb 2024 23:48:37 +0000 Subject: [PATCH 11/18] Update MEDI annotations --- .../Program.cs | 3 ++- .../IServiceCollectionExtensions.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index 91e68d232..4066c8c88 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -1,4 +1,3 @@ -using System.Text.Json; using JustSaying.Messaging; using JustSaying.Messaging.MessageSerialization; using JustSaying.Sample.Restaurant.Models; @@ -39,6 +38,7 @@ builder.Services.AddSingleton(sp => new SystemTextJsonSerializationFactory(sp.GetRequiredService>().Value.SerializerOptions)); +#pragma warning disable IL2026 // We provide SystemTextJsonSerializationFactory, which is trimming safe builder.Services.AddJustSaying(config => { config.Client(x => @@ -81,6 +81,7 @@ x.WithTopic(); }); }); +#pragma warning restore IL2026 // Added a message handler for message type for 'OrderReadyEvent' on topic 'orderreadyevent' and queue 'orderreadyevent' builder.Services.AddJustSayingHandler(); diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index b05e1f30a..f636215e5 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -26,6 +26,8 @@ namespace Microsoft.Extensions.DependencyInjection; [EditorBrowsable(EditorBrowsableState.Never)] public static class IServiceCollectionExtensions { + private const string UnreferencedCodeMessage = "The default IMessageSerializationFactory requires unreferenced code."; + /// /// Adds JustSaying services to the service collection. /// @@ -36,6 +38,9 @@ public static class IServiceCollectionExtensions /// /// is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(UnreferencedCodeMessage)] +#endif public static IServiceCollection AddJustSaying(this IServiceCollection services) { if (services == null) @@ -57,6 +62,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services) /// /// or is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(UnreferencedCodeMessage)] +#endif public static IServiceCollection AddJustSaying(this IServiceCollection services, string region) { if (services == null) @@ -85,6 +93,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, /// /// or is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(UnreferencedCodeMessage)] +#endif public static IServiceCollection AddJustSaying(this IServiceCollection services, Action configure) { if (services == null) @@ -111,6 +122,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services, /// /// or is . /// +#if NET8_0_OR_GREATER + [RequiresUnreferencedCode(UnreferencedCodeMessage)] +#endif public static IServiceCollection AddJustSaying(this IServiceCollection services, Action configure) { if (services == null) From 0cf53a3d76c13008deed17dbabc9927cb35e51d4 Mon Sep 17 00:00:00 2001 From: hwoodiwiss Date: Wed, 28 Feb 2024 00:06:38 +0000 Subject: [PATCH 12/18] Shift specific serializer options to sample --- .../MessagingJsonSerializerOptions.cs | 8 ++++++++ .../Program.cs | 6 +++--- .../IServiceCollectionExtensions.cs | 7 +------ .../JustSayingJsonSerializerOptions.cs | 10 ---------- .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 3 --- 5 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 samples/src/JustSaying.Sample.Restaurant.OrderingApi/MessagingJsonSerializerOptions.cs delete mode 100644 src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/MessagingJsonSerializerOptions.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/MessagingJsonSerializerOptions.cs new file mode 100644 index 000000000..f67c910a4 --- /dev/null +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/MessagingJsonSerializerOptions.cs @@ -0,0 +1,8 @@ +using System.Text.Json; + +namespace JustSaying.Sample.Restaurant.OrderingApi; + +public class MessagingJsonSerializerOptions +{ + public JsonSerializerOptions SerializerOptions { get; } = new(); +} diff --git a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs index 4066c8c88..17b3f19a0 100644 --- a/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs +++ b/samples/src/JustSaying.Sample.Restaurant.OrderingApi/Program.cs @@ -30,15 +30,15 @@ cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); - builder.Services.Configure(cfg => + builder.Services.Configure(cfg => { cfg.SerializerOptions.TypeInfoResolverChain.Insert(0, ApplicationJsonContext.Default); }); builder.Services.AddSingleton(sp => - new SystemTextJsonSerializationFactory(sp.GetRequiredService>().Value.SerializerOptions)); + new SystemTextJsonSerializationFactory(sp.GetRequiredService>().Value.SerializerOptions)); -#pragma warning disable IL2026 // We provide SystemTextJsonSerializationFactory, which is trimming safe +#pragma warning disable IL2026 // We provide SystemTextJsonSerializationFactory, which is AOT safe builder.Services.AddJustSaying(config => { config.Client(x => diff --git a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs index f636215e5..edf27ba32 100644 --- a/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs +++ b/src/JustSaying.Extensions.DependencyInjection.Microsoft/IServiceCollectionExtensions.cs @@ -12,11 +12,6 @@ using JustSaying.Models; using JustSaying.Naming; using Microsoft.Extensions.DependencyInjection.Extensions; -#if NET8_0_OR_GREATER -using System.Text.Json; -using Microsoft.Extensions.Options; -using System.Diagnostics.CodeAnalysis; -#endif namespace Microsoft.Extensions.DependencyInjection; @@ -26,7 +21,7 @@ namespace Microsoft.Extensions.DependencyInjection; [EditorBrowsable(EditorBrowsableState.Never)] public static class IServiceCollectionExtensions { - private const string UnreferencedCodeMessage = "The default IMessageSerializationFactory requires unreferenced code."; + private const string UnreferencedCodeMessage = "The default IMessageSerializationFactory implementation requires unreferenced code."; /// /// Adds JustSaying services to the service collection. diff --git a/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs b/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs deleted file mode 100644 index f113e9900..000000000 --- a/src/JustSaying/Messaging/MessageSerialization/JustSayingJsonSerializerOptions.cs +++ /dev/null @@ -1,10 +0,0 @@ -#if NET8_0_OR_GREATER -using System.Text.Json; - -namespace JustSaying.Messaging.MessageSerialization; - -public class JustSayingJsonSerializerOptions -{ - public JsonSerializerOptions SerializerOptions { get; } = new(); -} -#endif diff --git a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt index 936be332b..b7666b4d5 100644 --- a/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt +++ b/src/JustSaying/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -1,6 +1,3 @@ -JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions -JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions.JustSayingJsonSerializerOptions() -> void -JustSaying.Messaging.MessageSerialization.JustSayingJsonSerializerOptions.SerializerOptions.get -> System.Text.Json.JsonSerializerOptions JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.Deserialize(string message, System.Type type) -> JustSaying.Models.Message JustSaying.Messaging.MessageSerialization.SystemTextJsonSerializer.GetMessageAttributes(string message) -> JustSaying.Messaging.MessageHandling.MessageAttributes From bb28ec4e529cc32f4c5396ea265a2efc5fac80de Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Wed, 28 Feb 2024 09:38:51 +0000 Subject: [PATCH 13/18] Update obsolete comment Co-authored-by: Martin Costello --- .../Messaging/MessageSerialization/SystemTextJsonSerializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs index 48d776146..a925c1b92 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer.cs @@ -12,7 +12,7 @@ namespace JustSaying.Messaging.MessageSerialization; [RequiresUnreferencedCode(Constants.SerializationUnreferencedCodeMessage)] [RequiresDynamicCode(Constants.SerializationDynamicCodeMessage)] #endif -[Obsolete("This API is deprecated, and will be removed in a later version. Use SystemTextJsonSerializer instead.")] +[Obsolete("This API is deprecated, and will be removed in a future version. Use SystemTextJsonSerializer instead.")] public class SystemTextJsonSerializer : IMessageSerializer { private static readonly JsonSerializerOptions DefaultJsonSerializerOptions = new() From b5e6c64938b0f4b967e7a54ef5ba55293448c266 Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sun, 3 Mar 2024 23:22:36 +0000 Subject: [PATCH 14/18] Update comment --- src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs index 427bc6662..c09b473f3 100644 --- a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs +++ b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs @@ -9,7 +9,8 @@ internal static class JsonSerializerOptionsExtensions { public static JsonTypeInfo GetTypeInfo(this JsonSerializerOptions options) { - // This is not guarded as we want to throw if the desired type has not been configured for + // This throws an ArgumentException if type information is not available for a given type. + // We don't guard this to allow the default exception to be propagated. var typeInfo = options.GetTypeInfo(typeof(T)); return (JsonTypeInfo)typeInfo; } From 5ae305a4d13642bc60a309e40fab63170b97c186 Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sun, 3 Mar 2024 23:22:51 +0000 Subject: [PATCH 15/18] Mark RedrivePolicy as obsolete --- src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs | 1 + src/JustSaying/JustSayingSerializationContext.cs | 2 ++ .../AwsTools/QueueCreation/WhenSerializingRedrivePolicy.cs | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs b/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs index c9a584962..ac4b33fb7 100644 --- a/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs +++ b/src/JustSaying/AwsTools/QueueCreation/RedrivePolicy.cs @@ -3,6 +3,7 @@ namespace JustSaying.AwsTools.QueueCreation; +[Obsolete("This API is not used by the public API, and will be made internal in a future version.")] public class RedrivePolicy { [JsonProperty("maxReceiveCount")] diff --git a/src/JustSaying/JustSayingSerializationContext.cs b/src/JustSaying/JustSayingSerializationContext.cs index 3a0a6fb18..e50f64b5f 100644 --- a/src/JustSaying/JustSayingSerializationContext.cs +++ b/src/JustSaying/JustSayingSerializationContext.cs @@ -7,6 +7,8 @@ namespace JustSaying; [JsonSerializable(typeof(SqsMessageEnvelope))] [JsonSerializable(typeof(IReadOnlyCollection))] +#pragma warning disable CS0618 // Type or member is obsolete [JsonSerializable(typeof(RedrivePolicy))] +#pragma warning restore CS0618 // Type or member is obsolete internal sealed partial class JustSayingSerializationContext : JsonSerializerContext; #endif diff --git a/tests/JustSaying.UnitTests/AwsTools/QueueCreation/WhenSerializingRedrivePolicy.cs b/tests/JustSaying.UnitTests/AwsTools/QueueCreation/WhenSerializingRedrivePolicy.cs index 782153372..fd94ac8fc 100644 --- a/tests/JustSaying.UnitTests/AwsTools/QueueCreation/WhenSerializingRedrivePolicy.cs +++ b/tests/JustSaying.UnitTests/AwsTools/QueueCreation/WhenSerializingRedrivePolicy.cs @@ -1,4 +1,5 @@ using JustSaying.AwsTools.QueueCreation; +#pragma warning disable CS0618 // Type or member is obsolete namespace JustSaying.UnitTests.AwsTools.QueueCreation; @@ -15,4 +16,4 @@ public void CanDeserializeIntoRedrivePolicy() outputPolicy.MaximumReceives.ShouldBe(policy.MaximumReceives); outputPolicy.DeadLetterQueue.ShouldBe(policy.DeadLetterQueue); } -} \ No newline at end of file +} From aadf5dc9bba9237ecf11913da38762db3dd6051e Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Sun, 3 Mar 2024 23:38:09 +0000 Subject: [PATCH 16/18] Add tests TODO: Make test names/namespaces not the worst --- .../SystemTextJsonSerializer`1.cs | 2 +- ...alingWithPotentiallyMissingConversation.cs | 39 +++++++++++++++ .../WhenAskingForANewSerializer.cs | 24 ++++++++++ .../WhenSerializingAndDeserializing.cs | 45 +++++++++++++++++ .../WhenUsingCustomSettings.cs | 48 +++++++++++++++++++ 5 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/DealingWithPotentiallyMissingConversation.cs create mode 100644 tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenAskingForANewSerializer.cs create mode 100644 tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenSerializingAndDeserializing.cs create mode 100644 tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenUsingCustomSettings.cs diff --git a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs index a841185a9..b359aee39 100644 --- a/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs +++ b/src/JustSaying/Messaging/MessageSerialization/SystemTextJsonSerializer`1.cs @@ -160,7 +160,7 @@ private string SerializeCore(Message message) { #pragma warning disable IL3050 #pragma warning disable IL2026 - json = JsonSerializer.Serialize(message, _options); + json = JsonSerializer.Serialize(message, typeof(T), _options); #pragma warning restore IL2026 #pragma warning restore IL3050 } diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/DealingWithPotentiallyMissingConversation.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/DealingWithPotentiallyMissingConversation.cs new file mode 100644 index 000000000..d28efcfa4 --- /dev/null +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/DealingWithPotentiallyMissingConversation.cs @@ -0,0 +1,39 @@ +using JustSaying.Messaging.MessageSerialization; +using JustSaying.TestingFramework; + +namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson_1; + +#pragma warning disable CS0618 // Type or member is obsolete +public class DealingWithPotentiallyMissingConversation : XBehaviourTest> +#pragma warning restore CS0618 // Type or member is obsolete +{ + private MessageWithEnum _messageOut; + private MessageWithEnum _messageIn; + private string _jsonMessage; + + protected override void Given() + { + _messageOut = new MessageWithEnum() { EnumVal = Value.Two }; + } + + protected override void WhenAction() + { + _jsonMessage = SystemUnderTest.Serialize(_messageOut, false, _messageOut.GetType().Name); + + // Add extra property to see what happens: + _jsonMessage = _jsonMessage.Replace("{__", "{\"New\":\"Property\",__", StringComparison.OrdinalIgnoreCase); + _messageIn = SystemUnderTest.Deserialize(_jsonMessage, typeof(MessageWithEnum)) as MessageWithEnum; + } + + [Fact] + public void ItDoesNotHaveConversationPropertySerializedBecauseItIsNotSet_ThisIsForBackwardsCompatibilityWhenWeDeploy() + { + _jsonMessage.ShouldNotContain("Conversation"); + } + + [Fact] + public void DeserializedMessageHasEmptyConversation_ThisIsForBackwardsCompatibilityWhenWeDeploy() + { + _messageIn.Conversation.ShouldBeNull(); + } +} diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenAskingForANewSerializer.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenAskingForANewSerializer.cs new file mode 100644 index 000000000..e9594dbdd --- /dev/null +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenAskingForANewSerializer.cs @@ -0,0 +1,24 @@ +using JustSaying.Messaging.MessageSerialization; +using JustSaying.TestingFramework; + +namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson_1; + +public class WhenAskingForANewSerializer : XBehaviourTest +{ + private IMessageSerializer _result; + + protected override void Given() + { + } + + protected override void WhenAction() + { + _result = SystemUnderTest.GetSerializer(); + } + + [Fact] + public void OneIsProvided() + { + _result.ShouldNotBeNull(); + } +} diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenSerializingAndDeserializing.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenSerializingAndDeserializing.cs new file mode 100644 index 000000000..e4aa845e9 --- /dev/null +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenSerializingAndDeserializing.cs @@ -0,0 +1,45 @@ +using JustSaying.Messaging.MessageSerialization; +using JustSaying.TestingFramework; + +namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson_1; + +#pragma warning disable CS0618 // Type or member is obsolete +public class WhenSerializingAndDeserializing : XBehaviourTest +#pragma warning restore CS0618 // Type or member is obsolete +{ + private MessageWithEnum _messageOut; + private MessageWithEnum _messageIn; + private string _jsonMessage; + + protected override void Given() + { + _messageOut = new MessageWithEnum() { EnumVal = Value.Two }; + } + + protected override void WhenAction() + { + _jsonMessage = SystemUnderTest.Serialize(_messageOut, false, _messageOut.GetType().Name); + _messageIn = SystemUnderTest.Deserialize(_jsonMessage, typeof(MessageWithEnum)) as MessageWithEnum; + } + + [Fact] + public void MessageHasBeenCreated() + { + _messageOut.ShouldNotBeNull(); + } + + [Fact] + public void MessagesContainSameDetails() + { + _messageOut.EnumVal.ShouldBe(_messageIn.EnumVal); + _messageOut.RaisingComponent.ShouldBe(_messageIn.RaisingComponent); + _messageOut.TimeStamp.ShouldBe(_messageIn.TimeStamp); + } + + [Fact] + public void EnumsAreRepresentedAsStrings() + { + _jsonMessage.ShouldContain("EnumVal"); + _jsonMessage.ShouldContain("Two"); + } +} diff --git a/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenUsingCustomSettings.cs b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenUsingCustomSettings.cs new file mode 100644 index 000000000..696231a04 --- /dev/null +++ b/tests/JustSaying.UnitTests/Messaging/Serialization/SystemTextJson`1/WhenUsingCustomSettings.cs @@ -0,0 +1,48 @@ +using System.Text.Json; +using JustSaying.Messaging.MessageSerialization; +using JustSaying.TestingFramework; +using Newtonsoft.Json; + +namespace JustSaying.UnitTests.Messaging.Serialization.SystemTextJson_1; + +#pragma warning disable CS0618 // Type or member is obsolete +public class WhenUsingCustomSettings : XBehaviourTest> +{ + private MessageWithEnum _messageOut; + private string _jsonMessage; + + protected override SystemTextJsonSerializer CreateSystemUnderTest() + { + return new SystemTextJsonSerializer(new JsonSerializerOptions()); + } + + protected override void Given() + { + _messageOut = new MessageWithEnum() { EnumVal = Value.Two }; + } + + public string GetMessageInContext(MessageWithEnum message) + { + var context = new { Subject = message.GetType().Name, Message = SystemUnderTest.Serialize(message, false, message.GetType().Name) }; + return JsonConvert.SerializeObject(context); + } + + protected override void WhenAction() + { + _jsonMessage = GetMessageInContext(_messageOut); + } + + [Fact] + public void MessageHasBeenCreated() + { + _messageOut.ShouldNotBeNull(); + } + + [Fact] + public void EnumsAreNotRepresentedAsStrings() + { + _jsonMessage.ShouldContain("EnumVal"); + _jsonMessage.ShouldNotContain("Two"); + } +} +#pragma warning restore CS0618 From 97445076b9885c6a443b45b47e17c4ef9066a5d9 Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Mon, 4 Mar 2024 00:01:40 +0000 Subject: [PATCH 17/18] Add test for options extensions --- .../JsonSerializerOptionsExtensions.cs | 4 +-- .../JsonSerializerOptionsExtensionsTests.cs | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs diff --git a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs index c09b473f3..11a1b755b 100644 --- a/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs +++ b/src/JustSaying/Extensions/JsonSerializerOptionsExtensions.cs @@ -4,12 +4,12 @@ namespace JustSaying.Extensions; - internal static class JsonSerializerOptionsExtensions { public static JsonTypeInfo GetTypeInfo(this JsonSerializerOptions options) { - // This throws an ArgumentException if type information is not available for a given type. + // This throws a NotSupportedException if type information is not available for a given type, + // or an ArgumentException if the type is not valid for serialization (void, pointer types, and similar). // We don't guard this to allow the default exception to be propagated. var typeInfo = options.GetTypeInfo(typeof(T)); return (JsonTypeInfo)typeInfo; diff --git a/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs b/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs new file mode 100644 index 000000000..01b00a117 --- /dev/null +++ b/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs @@ -0,0 +1,36 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using JustSaying.Models; +using JustSaying.Extensions; + +namespace JustSaying.UnitTests.Extensions; + +public sealed partial class JsonSerializerOptionsExtensionsTests +{ + private readonly JsonSerializerOptions _sut = new() + { + TypeInfoResolver = TestSerializerContext.Default, + }; + + [Fact] + public void GetTypeInfo_ReturnsExpectedValue_WhenOptionsContainTypeInfo() + { + var result = _sut.GetTypeInfo(); + result.ShouldBeOfType>(); + } + + [Fact] + public void GetTypeInfo_ThrowsArgumentException_WhenOptionsDoNotContainTypeInfo() + { + var testAction = () => _sut.GetTypeInfo(); + testAction.ShouldThrow(); + } + + public class TestContainedClass : Message; + + public class TestNotContainedClass : Message; + + [JsonSerializable(typeof(TestContainedClass))] + public sealed partial class TestSerializerContext : JsonSerializerContext; +} From b74891d3ea445a1e1e97c760570c41d187520aaf Mon Sep 17 00:00:00 2001 From: Hugo Woodiwiss Date: Mon, 4 Mar 2024 00:16:16 +0000 Subject: [PATCH 18/18] Fix test name --- .../Extensions/JsonSerializerOptionsExtensionsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs b/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs index 01b00a117..b137b2266 100644 --- a/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs +++ b/tests/JustSaying.UnitTests/Extensions/JsonSerializerOptionsExtensionsTests.cs @@ -21,7 +21,7 @@ public void GetTypeInfo_ReturnsExpectedValue_WhenOptionsContainTypeInfo() } [Fact] - public void GetTypeInfo_ThrowsArgumentException_WhenOptionsDoNotContainTypeInfo() + public void GetTypeInfo_ThrowsNotSupportedException_WhenOptionsDoNotContainTypeInfo() { var testAction = () => _sut.GetTypeInfo(); testAction.ShouldThrow();