diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a729ebe7..cc13a550 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ### Pull requests are welcome -Pull requests are welcome. Ideally first state the problem or feature you need and engage in a discusssion on gitter or github issues. +Pull requests are welcome. Ideally first state the problem or feature you need and engage in a discussion on gitter or github issues. A high level design discussion will be needed for new features. ### Sign your work diff --git a/README.md b/README.md index ef67dd9a..74289afc 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ services.AddSlimMessageBus(mbb => .WithProviderKafka(cfg => { cfg.BrokerList = "localhost:9092"; }); // requires SlimMessageBus.Host.Kafka package // Use Azure Service Bus transport provider //.WithProviderServiceBus(cfg => { ... }) // requires SlimMessageBus.Host.AzureServiceBus package - // Use Azure Azure Event Hub transport provider + // Use Azure Event Hub transport provider //.WithProviderEventHub(cfg => { ... }) // requires SlimMessageBus.Host.AzureEventHub package // Use Redis transport provider //.WithProviderRedis(cfg => { ... }) // requires SlimMessageBus.Host.Redis package diff --git a/docs/intro.md b/docs/intro.md index 92d67461..8a9f0d01 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -72,7 +72,7 @@ services.AddSlimMessageBus(mbb => // Use Azure Service Bus transport provider (requires SlimMessageBus.Host.AzureServiceBus package) //.WithProviderServiceBus(...) - // Use Azure Azure Event Hub transport provider (requires SlimMessageBus.Host.AzureEventHub package) + // Use Azure Event Hub transport provider (requires SlimMessageBus.Host.AzureEventHub package) //.WithProviderEventHub(...) // Use Redis transport provider (requires SlimMessageBus.Host.Redis package) //.WithProviderRedis(...) @@ -124,7 +124,7 @@ Having done the SMB setup, one can then inject [`IMessageBus`](../src/SlimMessag > The `IMessageBus` implementations are lightweight and thread-safe. -For completness, please also see the [Hybrid provider configuration](provider_hybrid.md#configuration) which might be needed if the application needs to use more than one transport. +For completeness, please also see the [Hybrid provider configuration](provider_hybrid.md#configuration) which might be needed if the application needs to use more than one transport. ## Pub/Sub communication @@ -236,7 +236,7 @@ public class SomeConsumer #### Start or Stop message consumption By default message consumers are started as soon as the bus is created. This means that messages arriving on the given transport will be processed by the declared consumers. -If you want to prevent this default use the follwing setting: +If you want to prevent this default use the following setting: ```cs mbb.AutoStartConsumersEnabled(false); // default is true @@ -599,7 +599,7 @@ There is also an option to provide a type filter predicate. This might be helpfu ```cs services.AddSlimMessageBus(mbb => { - // Register the found types that contain DomainEventHandlers in the namespacce + // Register the found types that contain DomainEventHandlers in the namespace mbb.AddConsumersFromAssembly(Assembly.GetExecutingAssembly(), filter: (type) => type.Namespace.Contains("DomainEventHandlers")); }; ``` @@ -614,7 +614,7 @@ services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Ho services.AddSlimMessageBus(mbb => { // ... - mbb.AddAspNet(); // reqires SlimMessageBus.Host.AspNetCore + mbb.AddAspNet(); // requires SlimMessageBus.Host.AspNetCore }; ``` @@ -663,7 +663,7 @@ The `mbb.AddServicesFromAssembly()` extension method performs search for any imp - consumers `IConsumer`, `IRequestHandler` or `IRequestHandler`, - [interceptors](#interceptors) -Found types are registered (by default as `Transient`) servcices with the MSDI container. +Found types are registered (by default as `Transient`) services with the MSDI container. ```cs services.AddSlimMessageBus(mbb => @@ -686,7 +686,7 @@ The `MessageType` header will be set for every published (or produced) message t This approach allows SMB to send polymorphic message types (messages that share a common ancestry) and even send unrelated message types via the same topic/queue transport. -This mechanism should work fine with serializers that support polimorphic serialization (e.g. Newtonsoft.Json) and have that feature enabled. In such case a message type discriminator (e.g. `$type` property for Newtonsoft.Json) will be added by the serializer to the message payload, so that the deserializer on the consumer end knows to what type to deserialize the message to. +This mechanism should work fine with serializers that support polymorphic serialization (e.g. Newtonsoft.Json) and have that feature enabled. In such case a message type discriminator (e.g. `$type` property for Newtonsoft.Json) will be added by the serializer to the message payload, so that the deserializer on the consumer end knows to what type to deserialize the message to. However, the `MessageType` header takes precedence in SMB in matching the correct consumer. > For better interoperability, the `MessageType` header is optional. This is to support the scenario that other publishing system does not use SMB nor is able to set the header. However, in the absence of `MessageType` header the SMB consumer side, should expect only one type per topic/queue. If there were more than one message types on the same topic (or queue) SMB would not be able to infer what type actually arrived. @@ -815,7 +815,7 @@ mbb.Consume(x => }); ``` -All the arriving polymorphic message types will be matched agaist the declared consumers types that could accept the arrived message type and they will be activated. +All the arriving polymorphic message types will be matched against the declared consumers types that could accept the arrived message type and they will be activated. In this example: @@ -1009,7 +1009,7 @@ public interface IConsumerErrorHandler /// The message that failed to process. /// Performs another message processing try. The return value is relevant if the consumer was a request handler (it will be its response value). Ensure to pass the return value to the result of the error handler. /// The consumer context for the message processing pipeline. - /// Exception that ocurred during message processing. + /// Exception that occurred during message processing. /// The error handling result. Task OnHandleError(T message, Func> retry, IConsumerContext consumerContext, Exception exception); } diff --git a/docs/intro.t.md b/docs/intro.t.md index d227b96a..4c718cb0 100644 --- a/docs/intro.t.md +++ b/docs/intro.t.md @@ -72,7 +72,7 @@ services.AddSlimMessageBus(mbb => // Use Azure Service Bus transport provider (requires SlimMessageBus.Host.AzureServiceBus package) //.WithProviderServiceBus(...) - // Use Azure Azure Event Hub transport provider (requires SlimMessageBus.Host.AzureEventHub package) + // Use Azure Event Hub transport provider (requires SlimMessageBus.Host.AzureEventHub package) //.WithProviderEventHub(...) // Use Redis transport provider (requires SlimMessageBus.Host.Redis package) //.WithProviderRedis(...) @@ -124,7 +124,7 @@ Having done the SMB setup, one can then inject [`IMessageBus`](../src/SlimMessag > The `IMessageBus` implementations are lightweight and thread-safe. -For completness, please also see the [Hybrid provider configuration](provider_hybrid.md#configuration) which might be needed if the application needs to use more than one transport. +For completeness, please also see the [Hybrid provider configuration](provider_hybrid.md#configuration) which might be needed if the application needs to use more than one transport. ## Pub/Sub communication @@ -236,7 +236,7 @@ public class SomeConsumer #### Start or Stop message consumption By default message consumers are started as soon as the bus is created. This means that messages arriving on the given transport will be processed by the declared consumers. -If you want to prevent this default use the follwing setting: +If you want to prevent this default use the following setting: ```cs mbb.AutoStartConsumersEnabled(false); // default is true @@ -599,7 +599,7 @@ There is also an option to provide a type filter predicate. This might be helpfu ```cs services.AddSlimMessageBus(mbb => { - // Register the found types that contain DomainEventHandlers in the namespacce + // Register the found types that contain DomainEventHandlers in the namespace mbb.AddConsumersFromAssembly(Assembly.GetExecutingAssembly(), filter: (type) => type.Namespace.Contains("DomainEventHandlers")); }; ``` @@ -614,7 +614,7 @@ services.AddHttpContextAccessor(); // This is required for the SlimMessageBus.Ho services.AddSlimMessageBus(mbb => { // ... - mbb.AddAspNet(); // reqires SlimMessageBus.Host.AspNetCore + mbb.AddAspNet(); // requires SlimMessageBus.Host.AspNetCore }; ``` @@ -663,7 +663,7 @@ The `mbb.AddServicesFromAssembly()` extension method performs search for any imp - consumers `IConsumer`, `IRequestHandler` or `IRequestHandler`, - [interceptors](#interceptors) -Found types are registered (by default as `Transient`) servcices with the MSDI container. +Found types are registered (by default as `Transient`) services with the MSDI container. ```cs services.AddSlimMessageBus(mbb => @@ -686,7 +686,7 @@ The `MessageType` header will be set for every published (or produced) message t This approach allows SMB to send polymorphic message types (messages that share a common ancestry) and even send unrelated message types via the same topic/queue transport. -This mechanism should work fine with serializers that support polimorphic serialization (e.g. Newtonsoft.Json) and have that feature enabled. In such case a message type discriminator (e.g. `$type` property for Newtonsoft.Json) will be added by the serializer to the message payload, so that the deserializer on the consumer end knows to what type to deserialize the message to. +This mechanism should work fine with serializers that support polymorphic serialization (e.g. Newtonsoft.Json) and have that feature enabled. In such case a message type discriminator (e.g. `$type` property for Newtonsoft.Json) will be added by the serializer to the message payload, so that the deserializer on the consumer end knows to what type to deserialize the message to. However, the `MessageType` header takes precedence in SMB in matching the correct consumer. > For better interoperability, the `MessageType` header is optional. This is to support the scenario that other publishing system does not use SMB nor is able to set the header. However, in the absence of `MessageType` header the SMB consumer side, should expect only one type per topic/queue. If there were more than one message types on the same topic (or queue) SMB would not be able to infer what type actually arrived. @@ -815,7 +815,7 @@ mbb.Consume(x => }); ``` -All the arriving polymorphic message types will be matched agaist the declared consumers types that could accept the arrived message type and they will be activated. +All the arriving polymorphic message types will be matched against the declared consumers types that could accept the arrived message type and they will be activated. In this example: diff --git a/docs/plugin_outbox.md b/docs/plugin_outbox.md index bbde472a..6f73a48f 100644 --- a/docs/plugin_outbox.md +++ b/docs/plugin_outbox.md @@ -45,6 +45,7 @@ Startup setup: ```cs builder.Services.AddSlimMessageBus(mbb => { + mbb.PerMessageScopeEnabled(false); mbb .AddChildBus("Memory", mbb => { @@ -85,6 +86,7 @@ builder.Services.AddSlimMessageBus(mbb => .AddOutboxUsingDbContext(opts => { opts.PollBatchSize = 100; + opts.PollIdleSleep = TimeSpan.FromSeconds(10); opts.MessageCleanup.Interval = TimeSpan.FromSeconds(10); opts.MessageCleanup.Age = TimeSpan.FromMinutes(1); //opts.SqlSettings.TransactionIsolationLevel = System.Data.IsolationLevel.RepeatableRead; diff --git a/docs/provider_azure_eventhubs.md b/docs/provider_azure_eventhubs.md index b80fc7a4..04f0d840 100644 --- a/docs/provider_azure_eventhubs.md +++ b/docs/provider_azure_eventhubs.md @@ -67,7 +67,7 @@ services.AddSlimMessageBus(mbb => cfg.StorageConnectionString = storageConnectionString; cfg.StorageBlobContainerName = storageContainerName; - // More advanced settings can be changed on the the underlying AEH client + // More advanced settings can be changed on the underlying AEH client cfg.EventHubProducerClientOptionsFactory = (path) => new Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions { Identifier = $"MyService_{Guid.NewGuid()}" diff --git a/docs/provider_azure_servicebus.md b/docs/provider_azure_servicebus.md index 02268cfb..8cab0796 100644 --- a/docs/provider_azure_servicebus.md +++ b/docs/provider_azure_servicebus.md @@ -16,7 +16,7 @@ Please read the [Introduction](intro.md) before reading this provider documentat - [Handle Request Messages](#handle-request-messages) - [ASB Sessions](#asb-sessions) - [Topology Provisioning](#topology-provisioning) - - [Triger Topology Provisioning](#triger-topology-provisioning) + - [Trigger Topology Provisioning](#trigger-topology-provisioning) ## Configuration @@ -43,7 +43,7 @@ This determination is set as part of the bus builder configuration. ## Producing Messages -To produce a given `TMessage` to a Azure Serivce Bus queue (or topic) use: +To produce a given `TMessage` to a Azure Service Bus queue (or topic) use: ```cs // send TMessage to Azure SB queues @@ -312,7 +312,7 @@ The consumer side has to enable sessions: mbb.Consume(x => x .Queue(queue) .WithConsumer() - // Defines how many concurrent message processings will be done within a single ongoing session + // Defines how many concurrent message processors will be instantiated within a single ongoing session // To achieve FIFO, this should be 1 (the default) .Instances(1) // Enables sessions, this process can handle up to 10 sessions concurrently, each session will expire after 5 seconds of inactivity @@ -466,7 +466,7 @@ mbb.WithProviderServiceBus(cfg => }); ``` -### Triger Topology Provisioning +### Trigger Topology Provisioning > Since 1.19.3 diff --git a/docs/provider_hybrid.md b/docs/provider_hybrid.md index 58bdb00f..8bd912a0 100644 --- a/docs/provider_hybrid.md +++ b/docs/provider_hybrid.md @@ -72,17 +72,17 @@ The `IMessageBus` injected into any layer of your application will be the hybrid It is important to understand, that handlers (`IRequestHandler<>`) or consumers (`IConsumer<>`) registered will be managed by the respective child bus that they are configured on. There can be more than one child bus that can consume the given message type. In this case hybrid bus will route the message to all of the child bus. -By default any matching child bus will be executed in sequence. There is also an option to execute this in pararell (see the `PublishExecutionMode` setting on `HybridMessageBusSettings`). +By default any matching child bus will be executed in sequence. There is also an option to execute this in parallel (see the `PublishExecutionMode` setting on `HybridMessageBusSettings`). > A given request message type can only be handled by one child bus, however, non-request messages can by consumed by multiple child buses. -The request messages need exactly one handler to calculate the response, therefore if we had more than one handler for a given request it would be ambigous which response to return. +The request messages need exactly one handler to calculate the response, therefore if we had more than one handler for a given request it would be ambiguous which response to return. ### Shared configuration -Any setting applied at the hybrid bus builder level will be inherited by ech child transport bus. In the example mentioned, the memory and Azure SB busses will inherit the serializer and dependency resolver. +Any setting applied at the hybrid bus builder level will be inherited by each child transport bus. In the example mentioned, the memory and Azure SB buses will inherit the serializer and dependency resolver. -Individual child busses can provide their own serialization (or any other setting) and effectively override the serialization (or any other setting). +Individual child buses can provide their own serialization (or any other setting) and effectively override the serialization (or any other setting). > The Hybrid bus builder configurations of the producer (`Produce()`) and consumer (`Consume()`) will be added into every child bus producer/consumer registration list. diff --git a/docs/provider_kafka.md b/docs/provider_kafka.md index 46d75679..3195f64a 100644 --- a/docs/provider_kafka.md +++ b/docs/provider_kafka.md @@ -122,7 +122,7 @@ There are two possible options: ### Default partitioner with message key -Currently the [confluent-kafka-dotnet](https://github.com/confluentinc/confluent-kafka-dotnet) does not support custom partitioners (see [here](https://github.com/confluentinc/confluent-kafka-dotnet/issues/343)). +Currently, [confluent-kafka-dotnet](https://github.com/confluentinc/confluent-kafka-dotnet) does not support custom partitioners (see [here](https://github.com/confluentinc/confluent-kafka-dotnet/issues/343)). The default partitioner is supported, which works in this way: - when message key is not provided then partition is assigned using round-robin, diff --git a/docs/provider_redis.md b/docs/provider_redis.md index 8d3d406b..5ad67387 100644 --- a/docs/provider_redis.md +++ b/docs/provider_redis.md @@ -40,7 +40,7 @@ The `RedisMessageBusSettings` has additional settings that allow to override fac ### Connection string parameters -The list of all configuration parameters for the connectiong string can be found here: +The list of all configuration parameters for the connection string can be found here: https://stackexchange.github.io/StackExchange.Redis/Configuration ## Producer @@ -119,7 +119,7 @@ await bus.Publish(new SomeMessage()) Then all 3 service instances will have the message copy delivered to the `SomeConsumer` (even the service instance that published the message in question). This is because each service instance is an independent subscriber (independent Redis client). -> In redis pub/sub the published messages are not durable. At the time of publish only connected consumers will recieve the message. If any of your service instances comes online after the publish (had a downtime, was restarted) the previously publishied messages will not be delivered. +> In redis pub/sub the published messages are not durable. At the time of publish only connected consumers will receive the message. If any of your service instances comes online after the publish (had a downtime, was restarted) the previously published messages will not be delivered. ### Queues @@ -139,7 +139,7 @@ The queue (FIFO) is emulated using a [Redis list type](https://redis.io/docs/dat - the key represents the queue name, - the value is a Redis list type and stores messages (in FIFO order). -Internally the queue is implemetned in the following way: +Internally the queue is implemented in the following way: - producer will use the [`RPUSH`](https://redis.io/commands/rpush) to add the message at the tail of the list with a redis key (queue name), - consumer will use the [`LPOP`](https://redis.io/commands/lpop) to remove the massage from the head of the list with a redis key (queue name). @@ -147,8 +147,8 @@ Internally the queue is implemetned in the following way: > The implementation provides at-most-once delivery guarantee. There is a chance that the consumer process dies after it performs `LPOP` and before it fully processes the message. -Another implementation was also considered using [`RPOPLPUSH`](https://redis.io/commands/rpoplpush) that would allow for at-least-once quarantee. -However, that would require to manage individual per process instance local queues making tha runtime and configuration not practical. +Another implementation was also considered using [`RPOPLPUSH`](https://redis.io/commands/rpoplpush) that would allow for at-least-once guarantee. +However, that would require to manage individual per process instance local queues making the runtime and configuration not practical. ### Message Headers diff --git a/docs/serialization.md b/docs/serialization.md index 2b888923..4223c6ac 100644 --- a/docs/serialization.md +++ b/docs/serialization.md @@ -24,7 +24,7 @@ services.AddSlimMessageBus(mbb => }); ``` -If the bus is a Hybrid bus composed of other child buses, then we can register multiple serializers and instuct which serializer type to apply for the given child bus. +If the bus is a Hybrid bus composed of other child buses, then we can register multiple serializers and instruct which serializer type to apply for the given child bus. Consider the following example: ```cs @@ -50,7 +50,7 @@ services.AddSlimMessageBus(mbb => }); ``` -> The serializer will be a singleton used across all the concurently running tasks of producing and consuming messages in a given bus instance. The serializers are designed, so that they are Thread-safe. +> The serializer will be a singleton used across all the concurrently running tasks of producing and consuming messages in a given bus instance. The serializers are designed, so that they are Thread-safe. ## Json (Newtonsoft.Json) diff --git a/src/.editorconfig b/src/.editorconfig index 5fffe86d..fa0c35ca 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -74,7 +74,7 @@ csharp_space_around_binary_operators = before_and_after csharp_using_directive_placement = inside_namespace:silent csharp_prefer_simple_using_statement = true:suggestion csharp_prefer_braces = true:silent -csharp_style_namespace_declarations = block_scoped:silent +csharp_style_namespace_declarations = file_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_prefer_top_level_statements = true:silent csharp_style_expression_bodied_constructors = false:silent diff --git a/src/.gitignore b/src/.gitignore index f1e3d20e..0b02379d 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -6,6 +6,7 @@ *.user *.userosscache *.sln.docstates +*.lutconfig # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/src/Infrastructure/docker-compose.yml b/src/Infrastructure/docker-compose.yml index 0d2de654..2da9cc4e 100644 --- a/src/Infrastructure/docker-compose.yml +++ b/src/Infrastructure/docker-compose.yml @@ -11,23 +11,24 @@ services: kafka: container_name: slim.kafka - image: wurstmeister/kafka + image: wurstmeister/kafka:2.13-2.8.1 ports: - "9092:9092" environment: KAFKA_ADVERTISED_HOST_NAME: localhost KAFKA_CREATE_TOPICS: "user-test-ping:2:1,user-test-echo:2:1" KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + depends_on: + - zookeeper networks: - slim mqtt: container_name: slim.mqtt - image: eclipse-mosquitto + image: eclipse-mosquitto:2.0.18 ports: - "1883:1883" #default mqtt port - "9001:9001" #default mqtt port for websockets - volumes: - ./mosquitto.conf:/mosquitto/config/mosquitto.conf networks: @@ -35,7 +36,7 @@ services: rabbitmq: container_name: slim.rabbitmq - image: rabbitmq:3-management + image: rabbitmq:3.12.14-management-alpine ports: - 5672:5672 - 15672:15672 # user/pass: guest/guest @@ -44,7 +45,7 @@ services: redis: container_name: slim.redis - image: redis:7 + image: redis:7.2.5 ports: - 6379:6379 networks: @@ -52,7 +53,7 @@ services: sqldb: container_name: slim.sql - image: mcr.microsoft.com/mssql/server:2022-latest + image: mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04 environment: - ACCEPT_EULA=Y - SA_PASSWORD=SuperSecretP@55word @@ -63,7 +64,7 @@ services: storage: container_name: slim.storage - image: mcr.microsoft.com/azure-storage/azurite:latest + image: mcr.microsoft.com/azure-storage/azurite:3.31.0 command: "azurite --blobHost 0.0.0.0 --blobPort 11000 --queueHost 0.0.0.0 --queuePort 11001 --tableHost 0.0.0.0 --tablePort 11002 --location /data" environment: - AZURITE_ACCOUNTS=devstoreaccount1:Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==; diff --git a/src/Samples/Infrastructure/README.md b/src/Samples/Infrastructure/README.md index 11d17ce7..2af8ee58 100644 --- a/src/Samples/Infrastructure/README.md +++ b/src/Samples/Infrastructure/README.md @@ -1,4 +1,4 @@ -## Sample Infastucture +## Sample Infrastructure This folder contains some useful docker compose or kubernetes deployments assets that will help you run a simple test infrastructure. diff --git a/src/Samples/Sample.AsyncApi.Service/Messages/CustomerEventConsumer.cs b/src/Samples/Sample.AsyncApi.Service/Messages/CustomerEventConsumer.cs index c3cdc85d..a190f4f2 100644 --- a/src/Samples/Sample.AsyncApi.Service/Messages/CustomerEventConsumer.cs +++ b/src/Samples/Sample.AsyncApi.Service/Messages/CustomerEventConsumer.cs @@ -6,7 +6,7 @@ public class CustomerEventConsumer : IConsumer /// Process the and acts accordingly. /// /// - /// This will create an customer entry in the local databse for the created customer. + /// This will create an customer entry in the local database for the created customer. /// /// /// diff --git a/src/Samples/Sample.OutboxWebApi/Program.cs b/src/Samples/Sample.OutboxWebApi/Program.cs index 68d6a574..cfc3675b 100644 --- a/src/Samples/Sample.OutboxWebApi/Program.cs +++ b/src/Samples/Sample.OutboxWebApi/Program.cs @@ -87,7 +87,7 @@ // Alternatively, if we were not using EF, we could use a SqlConnection builder.Services.AddSlimMessageBusOutboxUsingSql(opts => { opts.PollBatchSize = 100; }); -// Register in the the container how to create SqlConnection +// Register in the container how to create SqlConnection builder.Services.AddTransient(svp => var configuration = svp.GetRequiredService(); var connectionString = configuration.GetConnectionString("DefaultConnection"); diff --git a/src/Samples/Sample.Serialization.ConsoleApp/Program.cs b/src/Samples/Sample.Serialization.ConsoleApp/Program.cs index e9dccaaf..3e3a75ec 100644 --- a/src/Samples/Sample.Serialization.ConsoleApp/Program.cs +++ b/src/Samples/Sample.Serialization.ConsoleApp/Program.cs @@ -27,7 +27,7 @@ enum Provider /// /// This sample shows: -/// 1. How tu use the Avro serializer (for contract Avro IDL first apprach to generate C# code) +/// 1. How to use the Avro serializer (for contract Avro IDL first approach to generate C# code) /// 2. How to combine two serializer approaches in one app (using the Hybrid serializer). /// class Program @@ -98,7 +98,7 @@ static async Task Main(string[] args) => await Host.CreateDefaultBuilder(args) //case Provider.Kafka: // // Ensure your Kafka broker is running - // var kafkaBrokers = Secrets.Service.PopulateSecrets(configurationconfiguration["Kafka:Brokers"]); + // var kafkaBrokers = Secrets.Service.PopulateSecrets(configuration["Kafka:Brokers"]); // var kafkaUsername = Secrets.Service.PopulateSecrets(configuration["Kafka:Username"]); // var kafkaPassword = Secrets.Service.PopulateSecrets(configuration["Kafka:Password"]); // var kafkaSecure = Secrets.Service.PopulateSecrets(configuration["Kafka:Secure"]); @@ -204,7 +204,7 @@ public class SubtractCommandConsumer : IConsumer { public async Task OnHandle(SubtractCommand message) { - Console.WriteLine("Consumer: Subracting {0} and {1} gives {2}", message.Left, message.Right, message.Left - message.Right); + Console.WriteLine("Consumer: Subtracting {0} and {1} gives {2}", message.Left, message.Right, message.Left - message.Right); await Task.Delay(50); // Simulate some work } } diff --git a/src/Samples/Sample.Serialization.MessagesAvro/README.md b/src/Samples/Sample.Serialization.MessagesAvro/README.md index 7fd4afcc..b9de3134 100644 --- a/src/Samples/Sample.Serialization.MessagesAvro/README.md +++ b/src/Samples/Sample.Serialization.MessagesAvro/README.md @@ -1,6 +1,6 @@ # What -This shows the Avro IDL contract first apparch using the Apache.Avro library. +This shows the Avro IDL contract first approach using the Apache.Avro library. First we need to define the IDL (*.avdl), then we generate C# classes from it. * The Avro contract is defined in [Avro IDL](https://avro.apache.org/docs/current/idl.html#overview_usage) (*.avdl). diff --git a/src/Samples/Sample.Serialization.MessagesAvro/Tools/gen.ps1 b/src/Samples/Sample.Serialization.MessagesAvro/Tools/gen.ps1 index a0deb737..c49793ba 100644 --- a/src/Samples/Sample.Serialization.MessagesAvro/Tools/gen.ps1 +++ b/src/Samples/Sample.Serialization.MessagesAvro/Tools/gen.ps1 @@ -7,7 +7,7 @@ $FILE = 'avro-tools.jar' $VERSION = '1.9.2' -# download the avro tools (if havent done so already) +# download the avro tools (if you haven't done so already) if(!(Test-Path -Path $FILE -PathType leaf)) { # if the link doesn't work check latest mirror link here: http://avro.apache.org/releases.html#Download diff --git a/src/SlimMessageBus.Host.AspNetCore/HttpContextAccessorCurrentMessageBusProvider.cs b/src/SlimMessageBus.Host.AspNetCore/HttpContextAccessorCurrentMessageBusProvider.cs index 3f56ad51..81dd8a2e 100644 --- a/src/SlimMessageBus.Host.AspNetCore/HttpContextAccessorCurrentMessageBusProvider.cs +++ b/src/SlimMessageBus.Host.AspNetCore/HttpContextAccessorCurrentMessageBusProvider.cs @@ -3,7 +3,7 @@ using SlimMessageBus; /// -/// Resolves the from the current ASP.NET Core web request (if present, otherwise falls back to the application root containser). +/// Resolves the from the current ASP.NET Core web request (if present, otherwise falls back to the application root container). /// internal class HttpContextAccessorCurrentMessageBusProvider : CurrentMessageBusProvider { diff --git a/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerBuilderExtensions.cs b/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerBuilderExtensions.cs index 6a74688f..dca52ffa 100644 --- a/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerBuilderExtensions.cs +++ b/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerBuilderExtensions.cs @@ -118,7 +118,7 @@ public static TConsumerBuilder PrefetchCount(this TConsumerBui } /// - /// Enables Azue Service Bus session support for this consumer + /// Enables Azure Service Bus session support for this consumer /// /// /// diff --git a/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerSessionBuilder.cs b/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerSessionBuilder.cs index a8c6a001..d6724ef7 100644 --- a/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerSessionBuilder.cs +++ b/src/SlimMessageBus.Host.AzureServiceBus/Config/AsbConsumerSessionBuilder.cs @@ -7,7 +7,7 @@ public class AsbConsumerSessionBuilder public AsbConsumerSessionBuilder(AbstractConsumerSettings consumerSettings) => ConsumerSettings = consumerSettings; /// - /// Sets the Azue Service Bus session idle timeout. + /// Sets the Azure Service Bus session idle timeout. /// /// /// @@ -19,7 +19,7 @@ public AsbConsumerSessionBuilder SessionIdleTimeout(TimeSpan sessionIdleTimeout) } /// - /// Sets the Azue Service Bus maximmum concurrent sessions that can be handled by this consumer. + /// Sets the Azure Service Bus maximum concurrent sessions that can be handled by this consumer. /// /// /// diff --git a/src/SlimMessageBus.Host.AzureServiceBus/Consumer/AsbBaseConsumer.cs b/src/SlimMessageBus.Host.AzureServiceBus/Consumer/AsbBaseConsumer.cs index 188ad6ce..9154d6d8 100644 --- a/src/SlimMessageBus.Host.AzureServiceBus/Consumer/AsbBaseConsumer.cs +++ b/src/SlimMessageBus.Host.AzureServiceBus/Consumer/AsbBaseConsumer.cs @@ -167,7 +167,7 @@ protected async Task ProcessMessageAsyncInternal(ServiceBusReceivedMessage messa var r = await MessageProcessor.ProcessMessage(message, message.ApplicationProperties, cancellationToken: token).ConfigureAwait(false); if (r.Exception != null) { - Logger.LogError(r.Exception, "Abandon message (exception occured while processing) - Path: {Path}, SubscriptionName: {SubscriptionName}, SequenceNumber: {SequenceNumber}, DeliveryCount: {DeliveryCount}, MessageId: {MessageId}", TopicSubscription.Path, TopicSubscription.SubscriptionName, message.SequenceNumber, message.DeliveryCount, message.MessageId); + Logger.LogError(r.Exception, "Abandon message (exception occurred while processing) - Path: {Path}, SubscriptionName: {SubscriptionName}, SequenceNumber: {SequenceNumber}, DeliveryCount: {DeliveryCount}, MessageId: {MessageId}", TopicSubscription.Path, TopicSubscription.SubscriptionName, message.SequenceNumber, message.DeliveryCount, message.MessageId); var messageProperties = new Dictionary { diff --git a/src/SlimMessageBus.Host.AzureServiceBus/ServiceBusMessageBusSettingsValidationService.cs b/src/SlimMessageBus.Host.AzureServiceBus/ServiceBusMessageBusSettingsValidationService.cs index 1dd79690..df4987b5 100644 --- a/src/SlimMessageBus.Host.AzureServiceBus/ServiceBusMessageBusSettingsValidationService.cs +++ b/src/SlimMessageBus.Host.AzureServiceBus/ServiceBusMessageBusSettingsValidationService.cs @@ -16,7 +16,7 @@ public override void AssertSettings() } var kindMapping = new KindMapping(); - // This will validae if one path is mapped to both a topic and a queue + // This will validate if one path is mapped to both a topic and a queue kindMapping.Configure(Settings); } diff --git a/src/SlimMessageBus.Host.Configuration/Builders/ConsumerBuilder.cs b/src/SlimMessageBus.Host.Configuration/Builders/ConsumerBuilder.cs index e106f541..4572e7a6 100644 --- a/src/SlimMessageBus.Host.Configuration/Builders/ConsumerBuilder.cs +++ b/src/SlimMessageBus.Host.Configuration/Builders/ConsumerBuilder.cs @@ -155,7 +155,7 @@ public ConsumerBuilder Instances(int numberOfInstances) } /// - /// Enable (or disable) creation of DI child scope for each meesage. + /// Enable (or disable) creation of DI child scope for each message. /// /// /// @@ -168,7 +168,7 @@ public ConsumerBuilder PerMessageScopeEnabled(bool enabled) /// /// Enable (or disable) disposal of consumer after message consumption. /// - /// This should be used in conjuction with . With per message scope enabled, the DI should dispose the consumer upon disposal of message scope. + /// This should be used in conjunction with . With per message scope enabled, the DI should dispose the consumer upon disposal of message scope. /// /// public ConsumerBuilder DisposeConsumerEnabled(bool enabled) diff --git a/src/SlimMessageBus.Host.Configuration/Builders/HandlerBuilder.cs b/src/SlimMessageBus.Host.Configuration/Builders/HandlerBuilder.cs index 15f7d3cb..3c46b887 100644 --- a/src/SlimMessageBus.Host.Configuration/Builders/HandlerBuilder.cs +++ b/src/SlimMessageBus.Host.Configuration/Builders/HandlerBuilder.cs @@ -82,7 +82,7 @@ public THandlerBuilder WithHandler(Type handlerType) } /// - /// Declares type the hadlner of a derived message. + /// Declares type the handler of a derived message. /// The handler type has to implement interface. /// /// The derived request type from type /param> diff --git a/src/SlimMessageBus.Host.Configuration/Builders/MessageBusBuilder.cs b/src/SlimMessageBus.Host.Configuration/Builders/MessageBusBuilder.cs index 79326f03..04ea49a8 100644 --- a/src/SlimMessageBus.Host.Configuration/Builders/MessageBusBuilder.cs +++ b/src/SlimMessageBus.Host.Configuration/Builders/MessageBusBuilder.cs @@ -139,7 +139,7 @@ public MessageBusBuilder Handle(Action - /// Configures (declares) the handler of a given request message type which nas no response message type. + /// Configures (declares) the handler of a given request message type which has no response message type. /// /// /// @@ -254,7 +254,7 @@ public MessageBusBuilder Do(Action builder) } /// - /// Sets the default enable (or disable) creation of DI child scope for each meesage. + /// Sets the default enable (or disable) creation of DI child scope for each message. /// /// /// @@ -292,7 +292,7 @@ public MessageBusBuilder WithHeaderModifier(MessageHeaderModifier header } /// - /// Hook called whenver message is being produced. Can be used to change message headers. + /// Hook called whenever message is being produced. Can be used to change message headers. /// /// Should the previously set modifier be executed as well? public MessageBusBuilder WithHeaderModifier(MessageHeaderModifier headerModifier, bool executePrevious = true) @@ -306,7 +306,7 @@ public MessageBusBuilder WithHeaderModifier(MessageHeaderModifier headerMo executePrevious); /// - /// Enables or disabled the auto statrt of message consumption upon bus creation. If false, then you need to call the .Start() on the bus to start consuming messages. + /// Enables or disabled the auto start of message consumption upon bus creation. If false, then you need to call the .Start() on the bus to start consuming messages. /// /// public MessageBusBuilder AutoStartConsumersEnabled(bool enabled) diff --git a/src/SlimMessageBus.Host.Configuration/Builders/ProducerBuilder.cs b/src/SlimMessageBus.Host.Configuration/Builders/ProducerBuilder.cs index a92cef53..e0c7be82 100644 --- a/src/SlimMessageBus.Host.Configuration/Builders/ProducerBuilder.cs +++ b/src/SlimMessageBus.Host.Configuration/Builders/ProducerBuilder.cs @@ -32,7 +32,7 @@ public ProducerBuilder DefaultTimeout(TimeSpan timeout) } /// - /// Hook called whenver message is being produced. Can be used to add (or mutate) message headers. + /// Hook called whenever message is being produced. Can be used to add (or mutate) message headers. /// public ProducerBuilder WithHeaderModifier(MessageHeaderModifier headerModifier) { diff --git a/src/SlimMessageBus.Host.Configuration/Settings/ConsumerSettings.cs b/src/SlimMessageBus.Host.Configuration/Settings/ConsumerSettings.cs index 7c187657..efcd7e6b 100644 --- a/src/SlimMessageBus.Host.Configuration/Settings/ConsumerSettings.cs +++ b/src/SlimMessageBus.Host.Configuration/Settings/ConsumerSettings.cs @@ -42,7 +42,7 @@ private void CalculateResponseType() /// public Type ResponseType { get; set; } /// - /// Determines if a child scope is created for the message consuption. The consumer instance is then derived from that scope. + /// Determines if a child scope is created for the message consumption. The consumer instance is then derived from that scope. /// public bool? IsMessageScopeEnabled { get; set; } /// diff --git a/src/SlimMessageBus.Host.Configuration/Settings/ProducerSettings.cs b/src/SlimMessageBus.Host.Configuration/Settings/ProducerSettings.cs index fc30e39c..0960550a 100644 --- a/src/SlimMessageBus.Host.Configuration/Settings/ProducerSettings.cs +++ b/src/SlimMessageBus.Host.Configuration/Settings/ProducerSettings.cs @@ -19,7 +19,7 @@ public class ProducerSettings : HasProviderExtensions /// public TimeSpan? Timeout { get; set; } /// - /// Hook called whenver message is being produced. Can be used to add (or mutate) message headers. + /// Hook called whenever message is being produced. Can be used to add (or mutate) message headers. /// public MessageHeaderModifier HeaderModifier { get; set; } } diff --git a/src/SlimMessageBus.Host.FluentValidation/FluentValidationMessageBusBuilder.cs b/src/SlimMessageBus.Host.FluentValidation/FluentValidationMessageBusBuilder.cs index 053316ae..09ca773c 100644 --- a/src/SlimMessageBus.Host.FluentValidation/FluentValidationMessageBusBuilder.cs +++ b/src/SlimMessageBus.Host.FluentValidation/FluentValidationMessageBusBuilder.cs @@ -108,7 +108,7 @@ public FluentValidationMessageBusBuilder AddConsumerValidatorsFromAssembly(Assem } /// - /// Registers an implemention of that uses the supplied lambda. The scope is singleton. + /// Registers an implementation of that uses the supplied lambda. The scope is singleton. /// /// /// /// Invoked when the master bus is created. - /// Can be used to initalize any resource before the messages are produced or consumed. + /// Can be used to initialize any resource before the messages are produced or consumed. /// Created, Starting, diff --git a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaGroupConsumer.cs b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaGroupConsumer.cs index ce5c06c6..3fa0e413 100644 --- a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaGroupConsumer.cs +++ b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaGroupConsumer.cs @@ -122,7 +122,7 @@ protected async virtual Task ConsumerLoop() { var pollRetryInterval = MessageBus.ProviderSettings.ConsumerPollRetryInterval; - Logger.LogError(e, "Group [{Group}]: Error occured while polling new messages (will retry in {RetryInterval}) - {Reason}", Group, pollRetryInterval, e.Error.Reason); + Logger.LogError(e, "Group [{Group}]: Error occurred while polling new messages (will retry in {RetryInterval}) - {Reason}", Group, pollRetryInterval, e.Error.Reason); await Task.Delay(pollRetryInterval, _consumerCts.Token).ConfigureAwait(false); } } @@ -144,7 +144,7 @@ protected async virtual Task ConsumerLoop() } catch (Exception e) { - Logger.LogError(e, "Group [{Group}]: Error occured in group loop (terminated)", Group); + Logger.LogError(e, "Group [{Group}]: Error occurred in group loop (terminated)", Group); } finally { diff --git a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumer.cs b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumer.cs index fad45a94..22d75b08 100644 --- a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumer.cs +++ b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumer.cs @@ -81,7 +81,7 @@ public void OnPartitionAssigned(TopicPartition partition) CheckpointTrigger?.Reset(); - // Generate a new token source if it wasnt created or the existing one was cancelled + // Generate a new token source if it wasn't created or the existing one was cancelled if (_cancellationTokenSource == null || _cancellationTokenSource.IsCancellationRequested) { _cancellationTokenSource?.Dispose(); @@ -115,7 +115,7 @@ public async Task OnMessage(ConsumeResult message) } catch (Exception e) { - _logger.LogError(e, "Group [{Group}]: Error occured while consuming a message at Topic: {Topic}, Partition: {Partition}, Offset: {Offset}", Group, message.Topic, message.Partition, message.Offset); + _logger.LogError(e, "Group [{Group}]: Error occurred while consuming a message at Topic: {Topic}, Partition: {Partition}, Offset: {Offset}", Group, message.Topic, message.Partition, message.Offset); throw; } } diff --git a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumerForResponses.cs b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumerForResponses.cs index ce76da8d..18f84732 100644 --- a/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumerForResponses.cs +++ b/src/SlimMessageBus.Host.Kafka/Consumer/KafkaPartitionConsumerForResponses.cs @@ -3,7 +3,7 @@ namespace SlimMessageBus.Host.Kafka; using ConsumeResult = ConsumeResult; /// -/// Processor for incomming response messages in the request-response patterns. +/// Processor for incoming response messages in the request-response patterns. /// See also . /// public class KafkaPartitionConsumerForResponses : KafkaPartitionConsumer diff --git a/src/SlimMessageBus.Host.Memory/MemoryMessageBusBuilder.cs b/src/SlimMessageBus.Host.Memory/MemoryMessageBusBuilder.cs index 745418cf..f8289edb 100644 --- a/src/SlimMessageBus.Host.Memory/MemoryMessageBusBuilder.cs +++ b/src/SlimMessageBus.Host.Memory/MemoryMessageBusBuilder.cs @@ -9,7 +9,7 @@ public class MemoryMessageBusBuilder : MessageBusBuilder { internal MemoryMessageBusBuilder(MessageBusBuilder other) : base(other) { - // If the user did not setup RequestResponse settings, apply a defult setting with long TimeOut + // If the user did not setup RequestResponse settings, apply a default setting with long TimeOut Settings.RequestResponse ??= new RequestResponseSettings { Timeout = TimeSpan.FromHours(1), @@ -21,7 +21,7 @@ internal MemoryMessageBusBuilder(MessageBusBuilder other) : base(other) /// /// Searches for any types that implement or in the specified assemblies. - /// For every found type declares the produced and consumer/handler by applying the topic name that corresponds to the mesage name. + /// For every found type declares the produced and consumer/handler by applying the topic name that corresponds to the message name. /// /// /// Allows to apply a filter for the found consumer/handler types. @@ -166,7 +166,7 @@ public MemoryMessageBusBuilder AutoDeclareFrom(params Assembly[] assemblies) /// /// In the specified assemblies, searches for any types that implement , or . - /// For every found type declares the producer and consumer/handler by applying the topic name that corresponds to the mesage name (provide custom converter to override this behavior). + /// For every found type declares the producer and consumer/handler by applying the topic name that corresponds to the message name (provide custom converter to override this behavior). /// /// /// Allows to apply a filter for any found consumer/handler. diff --git a/src/SlimMessageBus.Host.Memory/MemoryMessageBusSettings.cs b/src/SlimMessageBus.Host.Memory/MemoryMessageBusSettings.cs index 8a4f3987..ea39a5d5 100644 --- a/src/SlimMessageBus.Host.Memory/MemoryMessageBusSettings.cs +++ b/src/SlimMessageBus.Host.Memory/MemoryMessageBusSettings.cs @@ -13,7 +13,7 @@ public class MemoryMessageBusSettings /// /// The default behavior is to have Publish operations blocking (synchronous) and to wait for the message processing (handling) to finish. /// This is useful to ensure side effect within the unit of work (web request, external message handling) are completed. - /// However, if you prefer to have Publish operaions non-blocking (asynchronous), you can disable this setting. + /// However, if you prefer to have Publish operations non-blocking (asynchronous), you can disable this setting. /// public bool EnableBlockingPublish { get; set; } = true; } \ No newline at end of file diff --git a/src/SlimMessageBus.Host.Outbox.Sql/Configuration/BuilderExtensions.cs b/src/SlimMessageBus.Host.Outbox.Sql/Configuration/BuilderExtensions.cs index c29d467e..0d0d7612 100644 --- a/src/SlimMessageBus.Host.Outbox.Sql/Configuration/BuilderExtensions.cs +++ b/src/SlimMessageBus.Host.Outbox.Sql/Configuration/BuilderExtensions.cs @@ -7,7 +7,7 @@ public static class BuilderExtensions static readonly internal string PropertySqlTransactionEnabled = "SqlTransaction_Enabled"; /// - /// Enables the cration of for every message consumed by this bus. + /// Enables the creation of for every message consumed by this bus. /// /// /// @@ -19,7 +19,7 @@ public static MessageBusBuilder UseSqlTransaction(this MessageBusBuilder builder } /// - /// Enables the cration of for every message on this consumer. + /// Enables the creation of for every message on this consumer. /// /// /// @@ -31,7 +31,7 @@ public static ConsumerBuilder UseSqlTransaction(this ConsumerBuilder bu } /// - /// Enables the cration of every messages on this handler. + /// Enables the creation of every messages on this handler. /// /// /// diff --git a/src/SlimMessageBus.Host.Outbox.Sql/Interceptors/SqlTransactionConsumerInterceptor.cs b/src/SlimMessageBus.Host.Outbox.Sql/Interceptors/SqlTransactionConsumerInterceptor.cs index e1519662..7450b3f1 100644 --- a/src/SlimMessageBus.Host.Outbox.Sql/Interceptors/SqlTransactionConsumerInterceptor.cs +++ b/src/SlimMessageBus.Host.Outbox.Sql/Interceptors/SqlTransactionConsumerInterceptor.cs @@ -33,7 +33,7 @@ public async Task OnHandle(T message, Func> next, IConsumer logger.LogTrace("SqlTransaction - committing..."); await transactionService.CommitTransaction(); - logger.LogDebug("SqlTransaction - commited"); + logger.LogDebug("SqlTransaction - committed"); return result; } catch diff --git a/src/SlimMessageBus.Host.Outbox.Sql/ObjectToInferredTypesConverter.cs b/src/SlimMessageBus.Host.Outbox.Sql/ObjectToInferredTypesConverter.cs index 13a00a65..12f92e87 100644 --- a/src/SlimMessageBus.Host.Outbox.Sql/ObjectToInferredTypesConverter.cs +++ b/src/SlimMessageBus.Host.Outbox.Sql/ObjectToInferredTypesConverter.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; /// -/// Converter that invers object to primitive types. See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to?pivots=dotnet-7-0#deserialize-inferred-types-to-object-properties +/// Converter that infers object to primitive types. See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to?pivots=dotnet-7-0#deserialize-inferred-types-to-object-properties /// public class ObjectToInferredTypesConverter : JsonConverter { diff --git a/src/SlimMessageBus.Host.RabbitMQ/Config/Delegates.cs b/src/SlimMessageBus.Host.RabbitMQ/Config/Delegates.cs index 78dac4bd..c2846365 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Config/Delegates.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Config/Delegates.cs @@ -4,11 +4,11 @@ /// Represents an initializer that is able to perform additional RabbitMQ topology setup. /// /// The RabbitMQ client channel -/// Calling this action will peform the default topology setup by SMB +/// Calling this action will perform the default topology setup by SMB public delegate void RabbitMqTopologyInitializer(IModel channel, Action applyDefaultTopology); /// -/// Represents a key provider provider for a given message. +/// Represents a key provider for a given message. /// /// /// The message diff --git a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqConsumerContextExtensions.cs b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqConsumerContextExtensions.cs index 01d01372..b41ebeb4 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqConsumerContextExtensions.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqConsumerContextExtensions.cs @@ -34,7 +34,7 @@ static internal void SetConfirmAction(this IConsumerContext consumerContext, Rab static internal void ConfirmAction(this IConsumerContext consumerContext, RabbitMqMessageConfirmOptions option) { var messageConfirmAction = consumerContext.GetPropertyOrDefault(Key) - ?? throw new ConsumerMessageBusException("Cannnot perform RabbitMq message confirmation at this point"); + ?? throw new ConsumerMessageBusException("Cannot perform RabbitMq message confirmation at this point"); messageConfirmAction(option); } diff --git a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageAcknowledgementMode.cs b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageAcknowledgementMode.cs index 2a028a8f..bf94acfa 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageAcknowledgementMode.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageAcknowledgementMode.cs @@ -14,14 +14,14 @@ public enum RabbitMqMessageAcknowledgementMode ConfirmAfterMessageProcessingWhenNoManualConfirmMade = 0, /// - /// The message will already be considered as Ack upon recieve. See https://www.rabbitmq.com/docs/confirms#acknowledgement-modes for details. + /// The message will already be considered as Ack upon receive. See https://www.rabbitmq.com/docs/confirms#acknowledgement-modes for details. /// This results in at-most-once delivery guarantee (messages could be lost if processing would not fully finish). /// This is managed by the protocol and should give faster throughput than while leading to same delivery guarantees. /// AckAutomaticByRabbit = 1, /// - /// The message will be Ack-ed by SMB before the actuall message processing starts. + /// The message will be Ack-ed by SMB before the actual message processing starts. /// This results in at-most-once delivery guarantee (messages could be lost if processing would not fully finish). /// AckMessageBeforeProcessing = 2, diff --git a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageBusSettingsExtensions.cs b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageBusSettingsExtensions.cs index 7f55e842..e2634aa4 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageBusSettingsExtensions.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Config/RabbitMqMessageBusSettingsExtensions.cs @@ -24,7 +24,7 @@ public static RabbitMqMessageBusSettings UseTopologyInitializer(this RabbitMqMes } /// - /// Sets the default settings for exchanges on the bus level. This default will be taken unless it is overriden at the relevant producer level. + /// Sets the default settings for exchanges on the bus level. This default will be taken unless it is overridden at the relevant producer level. /// /// /// @@ -44,7 +44,7 @@ public static RabbitMqMessageBusSettings UseExchangeDefaults(this RabbitMqMessag } /// - /// Sets the default settings for dead letter exchanges on the bus level. This default will be taken unless it is overriden at the relevant producer level. + /// Sets the default settings for dead letter exchanges on the bus level. This default will be taken unless it is overridden at the relevant producer level. /// /// /// @@ -74,7 +74,7 @@ public static RabbitMqMessageBusSettings UseDeadLetterExchangeDefaults(this Rabb } /// - /// Sets the default settings for queues on the bus level. This default will be taken unless it is overriden at the relevant consumer level. + /// Sets the default settings for queues on the bus level. This default will be taken unless it is overridden at the relevant consumer level. /// /// /// diff --git a/src/SlimMessageBus.Host.RabbitMQ/Consumers/AbstractRabbitMqConsumer.cs b/src/SlimMessageBus.Host.RabbitMQ/Consumers/AbstractRabbitMqConsumer.cs index 2b1cda12..3100dbaa 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Consumers/AbstractRabbitMqConsumer.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Consumers/AbstractRabbitMqConsumer.cs @@ -24,7 +24,7 @@ protected AbstractRabbitMqConsumer(ILogger logger, IRabbitMqChannel channel, str protected override Task OnStart() { _consumer = new AsyncEventingBasicConsumer(_channel.Channel); - _consumer.Received += OnMessageRecieved; + _consumer.Received += OnMessageReceived; lock (_channel.ChannelLock) { @@ -46,7 +46,7 @@ protected override Task OnStop() return Task.CompletedTask; } - protected async Task OnMessageRecieved(object sender, BasicDeliverEventArgs @event) + protected async Task OnMessageReceived(object sender, BasicDeliverEventArgs @event) { if (_consumer == null) { @@ -68,7 +68,7 @@ protected async Task OnMessageRecieved(object sender, BasicDeliverEventArgs @eve } } - exception = await OnMessageRecieved(messageHeaders, @event); + exception = await OnMessageReceived(messageHeaders, @event); } catch (Exception ex) { @@ -80,7 +80,7 @@ protected async Task OnMessageRecieved(object sender, BasicDeliverEventArgs @eve } } - protected abstract Task OnMessageRecieved(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage); + protected abstract Task OnMessageReceived(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage); protected void NackMessage(BasicDeliverEventArgs @event, bool requeue) { diff --git a/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqConsumer.cs b/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqConsumer.cs index 748ed431..2040822c 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqConsumer.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqConsumer.cs @@ -70,7 +70,7 @@ private void ConfirmMessage(BasicDeliverEventArgs transportMessage, RabbitMqMess } } - protected override async Task OnMessageRecieved(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage) + protected override async Task OnMessageReceived(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage) { var consumerContextProperties = new Dictionary(); diff --git a/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqResponseConsumer.cs b/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqResponseConsumer.cs index c6374a11..a40bc40e 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqResponseConsumer.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/Consumers/RabbitMqResponseConsumer.cs @@ -12,7 +12,7 @@ public RabbitMqResponseConsumer(ILoggerFactory loggerFactory, IRabbitMqChannel c _messageProcessor = new ResponseMessageProcessor(loggerFactory, requestResponseSettings, messageBus, m => m.Body.ToArray()); } - protected override async Task OnMessageRecieved(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage) + protected override async Task OnMessageReceived(Dictionary messageHeaders, BasicDeliverEventArgs transportMessage) { var r = await _messageProcessor.ProcessMessage(transportMessage, messageHeaders: messageHeaders, cancellationToken: CancellationToken); if (r.Exception == null) diff --git a/src/SlimMessageBus.Host.RabbitMQ/DefaultHeaderValueConverter.cs b/src/SlimMessageBus.Host.RabbitMQ/DefaultHeaderValueConverter.cs index 31418033..f92a5680 100644 --- a/src/SlimMessageBus.Host.RabbitMQ/DefaultHeaderValueConverter.cs +++ b/src/SlimMessageBus.Host.RabbitMQ/DefaultHeaderValueConverter.cs @@ -3,7 +3,7 @@ using System.Text; /// -/// Peforms mappingg of the header value from the native RabbitMq client to SMB and vice vera. +/// Performs mapping of the header value from the native RabbitMq client to SMB and vice versa. /// Converts the string into a byte[] UTF-8 when sending the message to RabbitMq client, and converts that back to avoid the known problem: https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/415 /// public class DefaultHeaderValueConverter : IHeaderValueConverter diff --git a/src/SlimMessageBus.Host.Redis/Consumers/RedisListCheckerConsumer.cs b/src/SlimMessageBus.Host.Redis/Consumers/RedisListCheckerConsumer.cs index 5a9bc579..f178cd80 100644 --- a/src/SlimMessageBus.Host.Redis/Consumers/RedisListCheckerConsumer.cs +++ b/src/SlimMessageBus.Host.Redis/Consumers/RedisListCheckerConsumer.cs @@ -76,13 +76,13 @@ protected async Task Run() var r = await processor.ProcessMessage(transportMessage, transportMessage.Headers, cancellationToken: CancellationToken).ConfigureAwait(false); if (r.Exception != null) { - Logger.LogError(r.Exception, "Error occured while processing the list item on {Queue}", queue.Name); + Logger.LogError(r.Exception, "Error occurred while processing the list item on {Queue}", queue.Name); } } } catch (Exception e) { - Logger.LogError(e, "Error occured while processing the list item on {Queue}", queue.Name); + Logger.LogError(e, "Error occurred while processing the list item on {Queue}", queue.Name); } itemsArrived = true; diff --git a/src/SlimMessageBus.Host.Redis/Consumers/RedisTopicConsumer.cs b/src/SlimMessageBus.Host.Redis/Consumers/RedisTopicConsumer.cs index 5816d2a7..77204dff 100644 --- a/src/SlimMessageBus.Host.Redis/Consumers/RedisTopicConsumer.cs +++ b/src/SlimMessageBus.Host.Redis/Consumers/RedisTopicConsumer.cs @@ -54,7 +54,7 @@ private async Task OnMessage(ChannelMessage m) if (exception != null) { // In the future offer better error handling support - retries + option to put failed messages on a DLQ. - Logger.LogError(exception, "Error occured while processing the redis channel {Topic}", Path); + Logger.LogError(exception, "Error occurred while processing the redis channel {Topic}", Path); } } } diff --git a/src/SlimMessageBus.Host.Redis/RedisMessageBus.cs b/src/SlimMessageBus.Host.Redis/RedisMessageBus.cs index 7e6d2c2c..276f7365 100644 --- a/src/SlimMessageBus.Host.Redis/RedisMessageBus.cs +++ b/src/SlimMessageBus.Host.Redis/RedisMessageBus.cs @@ -42,7 +42,7 @@ protected override void Build() catch (Exception e) { // Do nothing - _logger.LogWarning(e, "Error occured while executing hook {HookName}", nameof(RedisMessageBusSettings.OnDatabaseConnected)); + _logger.LogWarning(e, "Error occurred while executing hook {HookName}", nameof(RedisMessageBusSettings.OnDatabaseConnected)); } } diff --git a/src/SlimMessageBus.Host.Redis/RedisMessageBusSettings.cs b/src/SlimMessageBus.Host.Redis/RedisMessageBusSettings.cs index 5eb93b34..93558ef5 100644 --- a/src/SlimMessageBus.Host.Redis/RedisMessageBusSettings.cs +++ b/src/SlimMessageBus.Host.Redis/RedisMessageBusSettings.cs @@ -23,13 +23,13 @@ public class RedisMessageBusSettings public TimeSpan? QueuePollDelay { get; set; } = TimeSpan.FromSeconds(1); /// - /// The serializer capable of serializing that wrap the actual message type. The wrapper is needed to transmit headers for redit transport which has no headers support. + /// The serializer capable of serializing that wraps the actual message type. The wrapper is needed to transmit headers for redis transport which has no headers support. /// By default uses . /// public IMessageSerializer EnvelopeSerializer { get; set; } /// - /// Hook that is fired when the Redis connection to database is established on startuo. Can be used to perform some Redis database cleanup or initialization. + /// Hook that is fired when the Redis connection to database is established on startup. Can be used to perform some Redis database cleanup or initialization. /// public Action OnDatabaseConnected { get; set; } diff --git a/src/SlimMessageBus.Host.Serialization.Avro/AvroMessageSerializer.cs b/src/SlimMessageBus.Host.Serialization.Avro/AvroMessageSerializer.cs index 831796af..8b49db64 100644 --- a/src/SlimMessageBus.Host.Serialization.Avro/AvroMessageSerializer.cs +++ b/src/SlimMessageBus.Host.Serialization.Avro/AvroMessageSerializer.cs @@ -39,7 +39,7 @@ public class AvroMessageSerializer : IMessageSerializer public Func ReadSchemaLookup { get; set; } /// - /// By default MessageFactory is set to use the strategy, WriteSchemaLookup and ReadSchemaLookup is set to use . + /// By default MessageFactory is set to use the strategy, WriteSchemaLookup and ReadSchemaLookup is set to use . /// public AvroMessageSerializer(ILoggerFactory loggerFactory = null) { @@ -49,7 +49,7 @@ public AvroMessageSerializer(ILoggerFactory loggerFactory = null) WriteMemoryStreamFactory = () => new MemoryStream(); ReadMemoryStreamFactory = (byte[] payload) => new MemoryStream(payload); - var mf = new ReflectionMessageCreationStategy(loggerFactory.CreateLogger()); + var mf = new ReflectionMessageCreationStrategy(loggerFactory.CreateLogger()); var ml = new ReflectionSchemaLookupStrategy(loggerFactory.CreateLogger()); MessageFactory = (Type type) => mf.Create(type); diff --git a/src/SlimMessageBus.Host.Serialization.Avro/DictionaryMessageCreationStategy.cs b/src/SlimMessageBus.Host.Serialization.Avro/DictionaryMessageCreationStategy.cs index e299f2a9..c8bce8b0 100644 --- a/src/SlimMessageBus.Host.Serialization.Avro/DictionaryMessageCreationStategy.cs +++ b/src/SlimMessageBus.Host.Serialization.Avro/DictionaryMessageCreationStategy.cs @@ -4,7 +4,7 @@ /// /// Strategy to create message instances using a dictionary which holds registered factory methods. -/// This should be faster than the strategy. +/// This should be faster than the strategy. /// public class DictionaryMessageCreationStategy : IMessageCreationStrategy { diff --git a/src/SlimMessageBus.Host.Serialization.Avro/DictionarySchemaLookupStrategy.cs b/src/SlimMessageBus.Host.Serialization.Avro/DictionarySchemaLookupStrategy.cs index 099ed6c2..bffc94e7 100644 --- a/src/SlimMessageBus.Host.Serialization.Avro/DictionarySchemaLookupStrategy.cs +++ b/src/SlimMessageBus.Host.Serialization.Avro/DictionarySchemaLookupStrategy.cs @@ -3,7 +3,7 @@ using global::Avro; /// -/// Stategy to lookup meessage schema by type using a dictionary registry +/// Strategy to lookup message schema by type using a dictionary registry /// public class DictionarySchemaLookupStrategy : ISchemaLookupStrategy { diff --git a/src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStategy.cs b/src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStrategy.cs similarity index 77% rename from src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStategy.cs rename to src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStrategy.cs index 415aad2f..8441d5fb 100644 --- a/src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStategy.cs +++ b/src/SlimMessageBus.Host.Serialization.Avro/ReflectionMessageCreationStrategy.cs @@ -1,56 +1,56 @@ -namespace SlimMessageBus.Host.Serialization.Avro; - -using System.Reflection; - -/// -/// Strategy to creates message instances using reflection. -/// Constructor objects are cached. -/// -public class ReflectionMessageCreationStategy : IMessageCreationStrategy -{ - private readonly ILogger _logger; - private readonly IDictionary _constructorByType = new Dictionary(); - private readonly object _constructorByTypeLock = new(); - - public ReflectionMessageCreationStategy(ILogger logger) - { - _logger = logger; - } - - protected virtual ConstructorInfo GetTypeConstructorSafe(Type type) - { - if (!_constructorByType.TryGetValue(type, out var constructor)) - { - constructor = type.GetConstructor(Type.EmptyTypes); - if (constructor == null) - { - throw new InvalidOperationException($"The type {type} does not have a paremeteless constructor"); - } - - lock (_constructorByTypeLock) - { - // Note of the key entry is already added it will be overriden here (expected) - _constructorByType[type] = constructor; - } - } - - return constructor; - } - - public virtual object Create(Type type) - { - try - { - // by default create types using reflection - _logger.LogDebug("Instantiating type {0}", type); - - var constructor = GetTypeConstructorSafe(type); - return constructor.Invoke(null); - } - catch (Exception e) - { - _logger.LogError(e, "Error intantiating message type {0}", type); - throw; - } - } -} +namespace SlimMessageBus.Host.Serialization.Avro; + +using System.Reflection; + +/// +/// Strategy to creates message instances using reflection. +/// Constructor objects are cached. +/// +public class ReflectionMessageCreationStrategy : IMessageCreationStrategy +{ + private readonly ILogger _logger; + private readonly IDictionary _constructorByType = new Dictionary(); + private readonly object _constructorByTypeLock = new(); + + public ReflectionMessageCreationStrategy(ILogger logger) + { + _logger = logger; + } + + protected virtual ConstructorInfo GetTypeConstructorSafe(Type type) + { + if (!_constructorByType.TryGetValue(type, out var constructor)) + { + constructor = type.GetConstructor(Type.EmptyTypes); + if (constructor == null) + { + throw new InvalidOperationException($"The type {type} does not have a parameterless constructor"); + } + + lock (_constructorByTypeLock) + { + // Note of the key entry is already added it will be overridden here (expected) + _constructorByType[type] = constructor; + } + } + + return constructor; + } + + public virtual object Create(Type type) + { + try + { + // by default create types using reflection + _logger.LogDebug("Instantiating type {Type}", type); + + var constructor = GetTypeConstructorSafe(type); + return constructor.Invoke(null); + } + catch (Exception e) + { + _logger.LogError(e, "Error instantiating message type {Type}", type); + throw; + } + } +} diff --git a/src/SlimMessageBus.Host.Serialization.Avro/SerializationBuilderExtensions.cs b/src/SlimMessageBus.Host.Serialization.Avro/SerializationBuilderExtensions.cs index 461f3e72..e72114ad 100644 --- a/src/SlimMessageBus.Host.Serialization.Avro/SerializationBuilderExtensions.cs +++ b/src/SlimMessageBus.Host.Serialization.Avro/SerializationBuilderExtensions.cs @@ -27,7 +27,7 @@ public static TBuilder AddAvroSerializer(this TBuilder builder, IMessa /// /// Registers the with implementation as . - /// Uses and strategies. + /// Uses and strategies. /// /// /// diff --git a/src/SlimMessageBus.Host.Serialization.SystemTextJson/ObjectToInferredTypesConverter.cs b/src/SlimMessageBus.Host.Serialization.SystemTextJson/ObjectToInferredTypesConverter.cs index 92f01da5..606b5a11 100644 --- a/src/SlimMessageBus.Host.Serialization.SystemTextJson/ObjectToInferredTypesConverter.cs +++ b/src/SlimMessageBus.Host.Serialization.SystemTextJson/ObjectToInferredTypesConverter.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; /// -/// Converter that invers object to primitive types. See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to?pivots=dotnet-7-0#deserialize-inferred-types-to-object-properties +/// Converter that infers object to primitive types. See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to?pivots=dotnet-7-0#deserialize-inferred-types-to-object-properties /// public class ObjectToInferredTypesConverter : JsonConverter { diff --git a/src/SlimMessageBus.Host.Sql/SqlMessageBus.cs b/src/SlimMessageBus.Host.Sql/SqlMessageBus.cs index 41a53fe1..727ef033 100644 --- a/src/SlimMessageBus.Host.Sql/SqlMessageBus.cs +++ b/src/SlimMessageBus.Host.Sql/SqlMessageBus.cs @@ -22,7 +22,7 @@ public override async Task ProvisionTopology() var sqlRepository = scope.ServiceProvider.GetService(); var sqlTransactionService = scope.ServiceProvider.GetService(); var provisioningService = new SqlTopologyService(LoggerFactory.CreateLogger(), (SqlRepository)sqlRepository, sqlTransactionService, ProviderSettings); - await provisioningService.Migrate(CancellationToken); // provisining happens asynchronously + await provisioningService.Migrate(CancellationToken); // provisioning happens asynchronously } protected override Task> ProduceToTransportBulk(IReadOnlyCollection envelopes, string path, IMessageBusTarget targetBus, CancellationToken cancellationToken) diff --git a/src/SlimMessageBus.Host/Collections/GenericTypeCache.cs b/src/SlimMessageBus.Host/Collections/GenericTypeCache.cs index 716fac8e..f57f6bf2 100644 --- a/src/SlimMessageBus.Host/Collections/GenericTypeCache.cs +++ b/src/SlimMessageBus.Host/Collections/GenericTypeCache.cs @@ -46,7 +46,7 @@ public class GenericTypeCache : IGenericTypeCache /// The open generic type e.g. . /// The method name on the open generic type. /// The return type of the method. - /// Additional method arguments (in addition to the message type which is the open generyc type param). + /// Additional method arguments (in addition to the message type which is the open generic type param). public GenericTypeCache(Type openGenericType, string methodName, Func returnTypeFunc, Func argumentTypesFunc = null) { _openGenericType = openGenericType; diff --git a/src/SlimMessageBus.Host/Collections/IRuntimeTypeCache.cs b/src/SlimMessageBus.Host/Collections/IRuntimeTypeCache.cs index 255af236..9eb9524c 100644 --- a/src/SlimMessageBus.Host/Collections/IRuntimeTypeCache.cs +++ b/src/SlimMessageBus.Host/Collections/IRuntimeTypeCache.cs @@ -10,7 +10,7 @@ public interface IRuntimeTypeCache IReadOnlyCache<(Type ClassType, string MethodName, Type GenericArgument), Func> GenericMethod { get; } /// - /// Providers a closed generic type fromt the one parameter open generic type and supplied generic parameter. + /// Provides a closed generic type for with as the generic parameter. /// /// /// diff --git a/src/SlimMessageBus.Host/Collections/SafeDictionaryWrapper.cs b/src/SlimMessageBus.Host/Collections/SafeDictionaryWrapper.cs index cacd03a6..3d5f6a75 100644 --- a/src/SlimMessageBus.Host/Collections/SafeDictionaryWrapper.cs +++ b/src/SlimMessageBus.Host/Collections/SafeDictionaryWrapper.cs @@ -86,7 +86,7 @@ public void Set(TKey key, TValue value) { lock (_lock) { - // allocate a new dictonary to avoid mutation while reading in another thread + // allocate a new dictionary to avoid mutation while reading in another thread _mutableDict[key] = value; OnChanged(); } diff --git a/src/SlimMessageBus.Host/Consumer/ErrorHandling/IConsumerErrorHandler.cs b/src/SlimMessageBus.Host/Consumer/ErrorHandling/IConsumerErrorHandler.cs index 787a05a0..557ed44d 100644 --- a/src/SlimMessageBus.Host/Consumer/ErrorHandling/IConsumerErrorHandler.cs +++ b/src/SlimMessageBus.Host/Consumer/ErrorHandling/IConsumerErrorHandler.cs @@ -10,7 +10,7 @@ public interface IConsumerErrorHandler /// The message that failed to process. /// Performs another message processing try. The return value is relevant if the consumer was a request handler (it will be its response value). Ensure to pass the return value to the result of the error handler. /// The consumer context for the message processing pipeline. - /// Exception that ocurred during message processing. + /// Exception that occurred during message processing. /// The error handling result. Task OnHandleError(T message, Func> retry, IConsumerContext consumerContext, Exception exception); } diff --git a/src/SlimMessageBus.Host/Consumer/MessageProcessors/MessageProcessor.cs b/src/SlimMessageBus.Host/Consumer/MessageProcessors/MessageProcessor.cs index a3e13399..41721ae6 100644 --- a/src/SlimMessageBus.Host/Consumer/MessageProcessors/MessageProcessor.cs +++ b/src/SlimMessageBus.Host/Consumer/MessageProcessors/MessageProcessor.cs @@ -198,12 +198,12 @@ protected IEnumerable TryMatchConsumerInvok { if (_shouldLogWhenUnrecognizedMessageType) { - _logger.LogInformation("The message on path {Path} declared {HeaderName} header of type {MessageType}, but none of the the known consumer types {ConsumerTypes} was able to handle that", Path, MessageHeaders.MessageType, messageType, string.Join(",", _invokers.Select(x => x.ConsumerType.Name))); + _logger.LogInformation("The message on path {Path} declared {HeaderName} header of type {MessageType}, but none of the known consumer types {ConsumerTypes} was able to handle it", Path, MessageHeaders.MessageType, messageType, string.Join(",", _invokers.Select(x => x.ConsumerType.Name))); } if (_shouldFailWhenUnrecognizedMessageType) { - throw new ConsumerMessageBusException($"The message on path {Path} declared {MessageHeaders.MessageType} header of type {messageType}, but none of the the known consumer types {string.Join(",", _invokers.Select(x => x.ConsumerType.Name))} was able to handle that"); + throw new ConsumerMessageBusException($"The message on path {Path} declared {MessageHeaders.MessageType} header of type {messageType}, but none of the known consumer types {string.Join(",", _invokers.Select(x => x.ConsumerType.Name))} was able to handle that"); } } } diff --git a/src/SlimMessageBus.Host/DependencyResolver/ServiceCollectionExtensions.cs b/src/SlimMessageBus.Host/DependencyResolver/ServiceCollectionExtensions.cs index f443914a..5db30fe7 100644 --- a/src/SlimMessageBus.Host/DependencyResolver/ServiceCollectionExtensions.cs +++ b/src/SlimMessageBus.Host/DependencyResolver/ServiceCollectionExtensions.cs @@ -24,7 +24,7 @@ public static IServiceCollection AddSlimMessageBus(this IServiceCollection servi { configure(mbb); - // Execute post config actions for the master bus and its childern + // Execute post config actions for the master bus and its children foreach (var action in mbb.PostConfigurationActions.Concat(mbb.Children.Values.SelectMany(x => x.PostConfigurationActions))) { action(services); @@ -107,8 +107,8 @@ public static IServiceCollection AddSlimMessageBus(this IServiceCollection servi /// /// /// The filter to be applied for the found types - only types that evaluate the given filter predicate will be registered in MSDI. - /// The consumer lifetime under which the found types should be registerd as. - /// The interceptor lifetime under which the found types should be registerd as. + /// The consumer lifetime under which the found types should be registered as. + /// The interceptor lifetime under which the found types should be registered as. /// public static MessageBusBuilder AddServicesFromAssembly( this MessageBusBuilder mbb, @@ -161,8 +161,8 @@ public static MessageBusBuilder AddServicesFromAssembly( /// /// /// The filter to be applied for the found types - only types that evaluate the given filter predicate will be registered in MSDI. - /// The consumer lifetime under which the found types should be registerd as. - /// The interceptor lifetime under which the found types should be registerd as. + /// The consumer lifetime under which the found types should be registered as. + /// The interceptor lifetime under which the found types should be registered as. /// public static MessageBusBuilder AddServicesFromAssemblyContaining( this MessageBusBuilder mbb, diff --git a/src/SlimMessageBus.Host/Helpers/Utils.cs b/src/SlimMessageBus.Host/Helpers/Utils.cs index 49204626..8d1cd9a1 100644 --- a/src/SlimMessageBus.Host/Helpers/Utils.cs +++ b/src/SlimMessageBus.Host/Helpers/Utils.cs @@ -31,21 +31,21 @@ public static async ValueTask DisposeSilently(this IAsyncDisposable disposable, public static void DisposeSilently(this IDisposable disposable, string name, ILogger logger) { - disposable.DisposeSilently(e => logger.LogWarning(e, "Error occured while disposing {Name}", name)); + disposable.DisposeSilently(e => logger.LogWarning(e, "Error occurred while disposing {Name}", name)); } public static void DisposeSilently(this IDisposable disposable, Func nameFunc, ILogger logger) { - disposable.DisposeSilently(e => logger.LogWarning(e, "Error occured while disposing {Name}", nameFunc())); + disposable.DisposeSilently(e => logger.LogWarning(e, "Error occurred while disposing {Name}", nameFunc())); } public static ValueTask DisposeSilently(this IAsyncDisposable disposable, Func nameFunc, ILogger logger) { - return disposable.DisposeSilently(e => logger.LogWarning(e, "Error occured while disposing {Name}", nameFunc())); + return disposable.DisposeSilently(e => logger.LogWarning(e, "Error occurred while disposing {Name}", nameFunc())); } public static ValueTask DisposeSilently(this IAsyncDisposable disposable, string name, ILogger logger) { - return disposable.DisposeSilently(e => logger.LogWarning(e, "Error occured while disposing {Name}", name)); + return disposable.DisposeSilently(e => logger.LogWarning(e, "Error occurred while disposing {Name}", name)); } } \ No newline at end of file diff --git a/src/SlimMessageBus.Host/Hybrid/HybridMessageBus.cs b/src/SlimMessageBus.Host/Hybrid/HybridMessageBus.cs index 690fcdda..95e7fe7c 100644 --- a/src/SlimMessageBus.Host/Hybrid/HybridMessageBus.cs +++ b/src/SlimMessageBus.Host/Hybrid/HybridMessageBus.cs @@ -27,7 +27,7 @@ public HybridMessageBus(MessageBusSettings settings, HybridMessageBusSettings pr Settings = settings ?? throw new ArgumentNullException(nameof(settings)); ProviderSettings = providerSettings ?? new HybridMessageBusSettings(); - // Try to resolve from DI, if also not available supress logging using the NullLoggerFactory + // Try to resolve from DI. If not available, suppress logging by using the NullLoggerFactory LoggerFactory = (ILoggerFactory)settings.ServiceProvider?.GetService(typeof(ILoggerFactory)) ?? NullLoggerFactory.Instance; _logger = LoggerFactory.CreateLogger(); @@ -60,7 +60,7 @@ public HybridMessageBus(MessageBusSettings settings, HybridMessageBusSettings pr _undeclaredMessageType = new(); - // ToDo: defer start of busses until here + // ToDo: defer start of buses until here } protected virtual MessageBusBase BuildBus(MessageBusBuilder builder) diff --git a/src/SlimMessageBus.Host/Hybrid/HybridMessageBusSettings.cs b/src/SlimMessageBus.Host/Hybrid/HybridMessageBusSettings.cs index f92f5140..9c656fd1 100644 --- a/src/SlimMessageBus.Host/Hybrid/HybridMessageBusSettings.cs +++ b/src/SlimMessageBus.Host/Hybrid/HybridMessageBusSettings.cs @@ -38,7 +38,7 @@ public enum PublishExecutionMode /// Sequential = 0, /// - /// Execute the publish on all of the buses in pararellel (non-deterministic order). + /// Execute the publish on all of the buses in parallel (non-deterministic order). /// Parallel = 2 } \ No newline at end of file diff --git a/src/SlimMessageBus.Host/IConsumerControl.cs b/src/SlimMessageBus.Host/IConsumerControl.cs index d5ca8aae..451ccd19 100644 --- a/src/SlimMessageBus.Host/IConsumerControl.cs +++ b/src/SlimMessageBus.Host/IConsumerControl.cs @@ -9,7 +9,7 @@ public interface IConsumerControl Task Start(); /// - /// Indicated wheather the consumers are started. + /// Indicated whether the consumers are started. /// bool IsStarted { get; } diff --git a/src/SlimMessageBus.Host/MessageBusBase.cs b/src/SlimMessageBus.Host/MessageBusBase.cs index af95cb4f..3324ea3f 100644 --- a/src/SlimMessageBus.Host/MessageBusBase.cs +++ b/src/SlimMessageBus.Host/MessageBusBase.cs @@ -89,7 +89,7 @@ protected MessageBusBase(MessageBusSettings settings) Settings = settings; - // Try to resolve from DI, if also not available supress logging using the NullLoggerFactory + // Try to resolve from DI. If not available, suppress logging by using the NullLoggerFactory LoggerFactory = settings.ServiceProvider.GetService() ?? NullLoggerFactory.Instance; _logger = LoggerFactory.CreateLogger(); diff --git a/src/SlimMessageBus.Host/MessageTypeResolver/AssemblyQualifiedNameMessageTypeResolver.cs b/src/SlimMessageBus.Host/MessageTypeResolver/AssemblyQualifiedNameMessageTypeResolver.cs index 8e24ec83..1a188131 100644 --- a/src/SlimMessageBus.Host/MessageTypeResolver/AssemblyQualifiedNameMessageTypeResolver.cs +++ b/src/SlimMessageBus.Host/MessageTypeResolver/AssemblyQualifiedNameMessageTypeResolver.cs @@ -12,7 +12,7 @@ public class AssemblyQualifiedNameMessageTypeResolver : IMessageTypeResolver private static readonly Regex RedundantAssemblyTokens = new(@"\, (Version|Culture|PublicKeyToken)\=([\w\d.]+)", RegexOptions.None, TimeSpan.FromSeconds(2)); /// - /// Determines wheather to emit the Version, Culture and PublicKeyToken along with the Assembly name (for strong assembly naming). + /// Determines whether to emit the Version, Culture and PublicKeyToken along with the Assembly name (for strong assembly naming). /// public bool EmitAssemblyStrongName { get; set; } = false; diff --git a/src/SlimMessageBus/IConsumerWithContext.cs b/src/SlimMessageBus/IConsumerWithContext.cs index 4c21078a..7e44d4fd 100644 --- a/src/SlimMessageBus/IConsumerWithContext.cs +++ b/src/SlimMessageBus/IConsumerWithContext.cs @@ -1,7 +1,7 @@ namespace SlimMessageBus; /// -/// An extension point for to recieve provider specific (for current message subject to processing). +/// An extension point for to receive provider specific (for current message subject to processing). /// public interface IConsumerWithContext { diff --git a/src/SlimMessageBus/IProducerContext.cs b/src/SlimMessageBus/IProducerContext.cs index 9e085672..0c6f7eaa 100644 --- a/src/SlimMessageBus/IProducerContext.cs +++ b/src/SlimMessageBus/IProducerContext.cs @@ -3,7 +3,7 @@ public interface IProducerContext { /// - /// The path (topic or queue) the will be deliverd to. + /// The path (topic or queue) that the message will be delivered to. /// string Path { get; } /// diff --git a/src/Tests/SlimMessageBus.Host.AzureEventHub.Test/EventHubMessageBusIt.cs b/src/Tests/SlimMessageBus.Host.AzureEventHub.Test/EventHubMessageBusIt.cs index c18c51ce..7c7c4ea2 100644 --- a/src/Tests/SlimMessageBus.Host.AzureEventHub.Test/EventHubMessageBusIt.cs +++ b/src/Tests/SlimMessageBus.Host.AzureEventHub.Test/EventHubMessageBusIt.cs @@ -68,10 +68,13 @@ public async Task BasicPubSub() }); var consumedMessages = ServiceProvider.GetRequiredService>(); - var messageBus = MessageBus; // act + + // consume all messages that might be on the queue/subscription + await consumedMessages.WaitUntilArriving(newMessagesTimeout: 5); + consumedMessages.Clear(); // publish var stopwatch = Stopwatch.StartNew(); diff --git a/src/Tests/SlimMessageBus.Host.Integration.Test/HybridTests.cs b/src/Tests/SlimMessageBus.Host.Integration.Test/HybridTests.cs index 20d76ea8..3c8e409e 100644 --- a/src/Tests/SlimMessageBus.Host.Integration.Test/HybridTests.cs +++ b/src/Tests/SlimMessageBus.Host.Integration.Test/HybridTests.cs @@ -91,7 +91,7 @@ private void SetupBus(MessageBusBuilder mbb, SerializerType serializerType) public record EventMark(Guid CorrelationId, string Name, Type ContextMessageBusType); /// - /// This test ensures that in a hybris bus setup External (Azure Service Bus) and Internal (Memory) the external message scope is carried over to memory bus, + /// This test ensures that in a hybrid bus setup External (Azure Service Bus) and Internal (Memory) the external message scope is carried over to memory bus, /// and that the interceptors are invoked (and in the correct order). /// /// @@ -106,7 +106,7 @@ public async Task When_PublishToMemoryBus_Given_InsideConsumerWithMessageScope_T servicesBuilder: services => { // Unit of work should be shared between InternalMessageConsumer and ExternalMessageConsumer. - // External consumer creates a message scope which continues to itnernal consumer. + // External consumer creates a message scope which continues to internal consumer. services.AddScoped(); // This is a singleton that will collect all the events that happened to verify later what actually happened. diff --git a/src/Tests/SlimMessageBus.Host.Kafka.Test/KafkaMessageBusIt.cs b/src/Tests/SlimMessageBus.Host.Kafka.Test/KafkaMessageBusIt.cs index c9b59c45..5871ce5c 100644 --- a/src/Tests/SlimMessageBus.Host.Kafka.Test/KafkaMessageBusIt.cs +++ b/src/Tests/SlimMessageBus.Host.Kafka.Test/KafkaMessageBusIt.cs @@ -123,6 +123,10 @@ public async Task BasicPubSub() var messageBus = MessageBus; // act + + // consume all messages that might be on the queue/subscription + await consumedMessages.WaitUntilArriving(newMessagesTimeout: 5); + consumedMessages.Clear(); // publish var stopwatch = Stopwatch.StartNew(); diff --git a/src/Tests/SlimMessageBus.Host.Mqtt.Test/MqttMessageBusIt.cs b/src/Tests/SlimMessageBus.Host.Mqtt.Test/MqttMessageBusIt.cs index 8a26ac93..b52a2f32 100644 --- a/src/Tests/SlimMessageBus.Host.Mqtt.Test/MqttMessageBusIt.cs +++ b/src/Tests/SlimMessageBus.Host.Mqtt.Test/MqttMessageBusIt.cs @@ -153,7 +153,7 @@ private async Task BasicReqResp() var responseTasks = requests.Select(async req => { var resp = await messageBus.Send(req); - Logger.LogDebug("Recieved response for index {EchoIndex:000}", req.Index); + Logger.LogDebug("Received response for index {EchoIndex:000}", req.Index); responses.Add((req, resp)); }); await Task.WhenAll(responseTasks); diff --git a/src/Tests/SlimMessageBus.Host.Outbox.DbContext.Test/Usings.cs b/src/Tests/SlimMessageBus.Host.Outbox.DbContext.Test/Usings.cs index 0aedb8b2..1c22dc7b 100644 --- a/src/Tests/SlimMessageBus.Host.Outbox.DbContext.Test/Usings.cs +++ b/src/Tests/SlimMessageBus.Host.Outbox.DbContext.Test/Usings.cs @@ -1,4 +1,3 @@ -global using System.ComponentModel; global using System.Diagnostics; global using System.Reflection; @@ -22,4 +21,4 @@ global using SlimMessageBus.Host.Test.Common.IntegrationTest; global using Xunit; -global using Xunit.Abstractions; +global using Xunit.Abstractions; \ No newline at end of file diff --git a/src/Tests/SlimMessageBus.Host.RabbitMQ.Test/IntegrationTests/RabbitMqMessageBusIt.cs b/src/Tests/SlimMessageBus.Host.RabbitMQ.Test/IntegrationTests/RabbitMqMessageBusIt.cs index 05057c9f..ec62d3b5 100644 --- a/src/Tests/SlimMessageBus.Host.RabbitMQ.Test/IntegrationTests/RabbitMqMessageBusIt.cs +++ b/src/Tests/SlimMessageBus.Host.RabbitMQ.Test/IntegrationTests/RabbitMqMessageBusIt.cs @@ -49,7 +49,7 @@ protected override void SetupServices(ServiceCollection services, IConfiguration channel.ExchangeDelete("test-ping", ifUnused: true); channel.ExchangeDelete("subscriber-dlq", ifUnused: true); - // apply default SMB infered topology + // apply default SMB inferred topology applyDefaultTopology(); // after diff --git a/src/Tests/SlimMessageBus.Host.Redis.Test/RedisMessageBusIt.cs b/src/Tests/SlimMessageBus.Host.Redis.Test/RedisMessageBusIt.cs index 2ee149ff..2a7e44ce 100644 --- a/src/Tests/SlimMessageBus.Host.Redis.Test/RedisMessageBusIt.cs +++ b/src/Tests/SlimMessageBus.Host.Redis.Test/RedisMessageBusIt.cs @@ -222,7 +222,7 @@ private async Task BasicReqResp() var responseTasks = requests.Select(async req => { var resp = await messageBus.Send(req).ConfigureAwait(false); - Logger.LogDebug("Recieved response for index {0:000}", req.Index); + Logger.LogDebug("Received response for index {0:000}", req.Index); responses.Add((req, resp)); }); await Task.WhenAll(responseTasks).ConfigureAwait(false); diff --git a/src/Tests/SlimMessageBus.Host.Test/MessageBusBaseTests.cs b/src/Tests/SlimMessageBus.Host.Test/MessageBusBaseTests.cs index 7795a37f..0b0fea6f 100644 --- a/src/Tests/SlimMessageBus.Host.Test/MessageBusBaseTests.cs +++ b/src/Tests/SlimMessageBus.Host.Test/MessageBusBaseTests.cs @@ -181,7 +181,7 @@ public async Task When_NoTimeoutProvided_Then_TakesDefaultTimeoutForRequestTypeA raTask.IsCanceled.Should().BeTrue(); rbTask.IsCanceled.Should().BeFalse(); - // adter 20 seconds + // after 20 seconds _timeNow = _timeZero.AddSeconds(TimeoutDefault10 + 1); Bus.TriggerPendingRequestCleanup();