From f05a9fb1c2db0d1d366baf6999d31d8532d5c940 Mon Sep 17 00:00:00 2001 From: Rafael Lillo <7280959+lillo42@users.noreply.github.com> Date: Fri, 8 May 2026 18:22:03 +0100 Subject: [PATCH 1/2] fix breaking change and set min brighter version as 10.4 --- Directory.Build.props | 1 + Directory.Packages.props | 5 +++-- src/Fluent.Brighter.MySql/Fluent.Brighter.MySql.csproj | 2 +- src/Fluent.Brighter/ConsumerBuilder.cs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 92cb923..9152148 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,6 +19,7 @@ netstandard2.0;net8.0;net9.0;net10.0 + net8.0;net9.0 net472;net8.0;net9.0;net10.0 net8.0;net9.0;net10.0 true diff --git a/Directory.Packages.props b/Directory.Packages.props index 8823196..2de3e15 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,6 +1,6 @@ - [10.0.0, 11.0.0) + [10.4.0, 11.0.0) @@ -8,7 +8,6 @@ - @@ -54,7 +53,9 @@ + + all diff --git a/src/Fluent.Brighter.MySql/Fluent.Brighter.MySql.csproj b/src/Fluent.Brighter.MySql/Fluent.Brighter.MySql.csproj index b127f9c..454567b 100644 --- a/src/Fluent.Brighter.MySql/Fluent.Brighter.MySql.csproj +++ b/src/Fluent.Brighter.MySql/Fluent.Brighter.MySql.csproj @@ -1,7 +1,7 @@  - $(BrighterTargetFrameworks) + $(BrighterTargetFrameworksNot10) true enable diff --git a/src/Fluent.Brighter/ConsumerBuilder.cs b/src/Fluent.Brighter/ConsumerBuilder.cs index 9e2cd7d..d097a96 100644 --- a/src/Fluent.Brighter/ConsumerBuilder.cs +++ b/src/Fluent.Brighter/ConsumerBuilder.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Paramore.Brighter; +using Paramore.Brighter.Extensions; using Paramore.Brighter.FeatureSwitch; using Paramore.Brighter.Observability; using Paramore.Brighter.ServiceActivator.Extensions.DependencyInjection; From b8293040b010f0f4fe4a2195a58680880fe0c265 Mon Sep 17 00:00:00 2001 From: Rafael Lillo <7280959+lillo42@users.noreply.github.com> Date: Fri, 8 May 2026 18:55:01 +0100 Subject: [PATCH 2/2] fix brighter breaking changes --- .../Extensions/ConsumerBuilderExtensions.cs | 4 +- .../SpannerInboxBuilder.cs | 12 +- .../RedisSubscriptionBuilder.cs | 112 ++++++------------ .../RocketMqSubscriptionBuilder.cs | 1 + 4 files changed, 47 insertions(+), 82 deletions(-) diff --git a/src/Fluent.Brighter.GoogleCloud/Extensions/ConsumerBuilderExtensions.cs b/src/Fluent.Brighter.GoogleCloud/Extensions/ConsumerBuilderExtensions.cs index 83bb974..b07651a 100644 --- a/src/Fluent.Brighter.GoogleCloud/Extensions/ConsumerBuilderExtensions.cs +++ b/src/Fluent.Brighter.GoogleCloud/Extensions/ConsumerBuilderExtensions.cs @@ -167,9 +167,9 @@ string connectionString /// Configures the consumer to use Google Cloud Spanner as the inbox storage with a pre-configured inbox instance. /// /// The consumer builder instance. - /// The configured instance. + /// The configured instance. /// The consumer builder for method chaining. - public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder, SpannerInbox inbox) + public static ConsumerBuilder UseSpannerInbox(this ConsumerBuilder builder, SpannerInboxAsync inbox) { return builder.SetInbox(cfg => cfg.SetInbox(inbox)); } diff --git a/src/Fluent.Brighter.GoogleCloud/SpannerInboxBuilder.cs b/src/Fluent.Brighter.GoogleCloud/SpannerInboxBuilder.cs index 84d090b..6e46c1a 100644 --- a/src/Fluent.Brighter.GoogleCloud/SpannerInboxBuilder.cs +++ b/src/Fluent.Brighter.GoogleCloud/SpannerInboxBuilder.cs @@ -4,7 +4,7 @@ namespace Fluent.Brighter.GoogleCloud; /// -/// Builder class for creating instances of . +/// Builder class for creating instances of . /// Provides a fluent API for configuring Google Cloud Spanner inbox storage. /// public sealed class SpannerInboxBuilder @@ -38,11 +38,11 @@ IAmARelationalDbConnectionProvider connectionProvider } /// - /// Builds a new instance of using the configured settings. + /// Builds a new instance of using the configured settings. /// - /// A configured instance. + /// A configured instance. /// Thrown when configuration is not set. - internal SpannerInbox Build() + internal SpannerInboxAsync Build() { if (_configuration == null) { @@ -50,7 +50,7 @@ internal SpannerInbox Build() } return _connectionProvider == null - ? new SpannerInbox(_configuration) - : new SpannerInbox(_configuration, _connectionProvider); + ? new SpannerInboxAsync(_configuration) + : new SpannerInboxAsync(_configuration, _connectionProvider); } } \ No newline at end of file diff --git a/src/Fluent.Brighter.Redis/RedisSubscriptionBuilder.cs b/src/Fluent.Brighter.Redis/RedisSubscriptionBuilder.cs index dec1695..d6dbc80 100644 --- a/src/Fluent.Brighter.Redis/RedisSubscriptionBuilder.cs +++ b/src/Fluent.Brighter.Redis/RedisSubscriptionBuilder.cs @@ -1,5 +1,4 @@ using System; - using Paramore.Brighter; using Paramore.Brighter.MessagingGateway.Redis; @@ -13,7 +12,7 @@ namespace Fluent.Brighter.Redis; public sealed class RedisSubscriptionBuilder { private SubscriptionName _subscriptionName = new(Uuid.New().ToString("N")); - + /// /// Sets the subscription name that uniquely identifies this subscription. /// The subscription name is used to track and manage the subscription within the Brighter framework. @@ -25,10 +24,10 @@ public RedisSubscriptionBuilder SetSubscription(SubscriptionName subscriptionNam _subscriptionName = subscriptionName; return this; } - + private ChannelName? _channelName; private RoutingKey? _routingKey; - + /// /// Sets the channel name and routing key for the subscription. /// The channel represents the Redis queue/topic from which messages will be consumed. @@ -41,7 +40,7 @@ public RedisSubscriptionBuilder SetQueue(ChannelName channelName) _channelName = channelName; return this; } - + /// /// Sets the routing key (topic) for the subscription. /// This determines which messages will be routed to this subscription based on the topic pattern. @@ -53,9 +52,9 @@ public RedisSubscriptionBuilder SetTopic(RoutingKey routingKey) _routingKey = routingKey; return this; } - + private Type? _dataType; - + /// /// Sets the data type for messages in this subscription. /// When provided, this method will automatically configure the subscription name, channel name, @@ -66,7 +65,7 @@ public RedisSubscriptionBuilder SetTopic(RoutingKey routingKey) public RedisSubscriptionBuilder SetDataType(Type? dataType) { _dataType = dataType; - + if (dataType != null) { var typeName = dataType.FullName!; @@ -74,12 +73,12 @@ public RedisSubscriptionBuilder SetDataType(Type? dataType) _channelName ??= new ChannelName(typeName); _routingKey ??= new RoutingKey(typeName); } - + return this; } - + private Func? _getRequestType; - + /// /// Sets a function that determines the request type dynamically based on the message content. /// This allows for polymorphic message handling where different message types can be processed by different handlers. @@ -91,9 +90,9 @@ public RedisSubscriptionBuilder SetGetRequestType(Func? getReques _getRequestType = getRequestType; return this; } - + private int _bufferSize = 1; - + /// /// Sets the buffer size for the message channel. /// The buffer size determines how many messages can be queued in memory before processing, @@ -106,9 +105,9 @@ public RedisSubscriptionBuilder SetBufferSize(int bufferSize) _bufferSize = bufferSize; return this; } - + private int _noOfPerformers = 1; - + /// /// Sets the number of performer threads that will process messages concurrently. /// Multiple performers allow parallel message processing, improving throughput for I/O-bound operations. @@ -120,9 +119,9 @@ public RedisSubscriptionBuilder SetNumberOfPerformers(int noOfPerformers) _noOfPerformers = noOfPerformers; return this; } - + private TimeSpan? _timeOut; - + /// /// Sets the timeout duration for message processing operations. /// If a message handler takes longer than this timeout, the operation will be cancelled. @@ -134,9 +133,9 @@ public RedisSubscriptionBuilder SetTimeout(TimeSpan? timeout) _timeOut = timeout; return this; } - + private int _requeueCount = -1; - + /// /// Sets the maximum number of times a failed message will be requeued for retry. /// Messages that fail processing can be retried up to this limit before being moved to a dead letter queue or discarded. @@ -148,9 +147,9 @@ public RedisSubscriptionBuilder SetRequeueCount(int requeueCount) _requeueCount = requeueCount; return this; } - + private TimeSpan? _requeueDelay; - + /// /// Sets the delay before a failed message is requeued for retry. /// This provides a backoff period before attempting to process the message again, which can help with transient failures. @@ -162,9 +161,9 @@ public RedisSubscriptionBuilder SetRequeueDelay(TimeSpan? requeueDelay) _requeueDelay = requeueDelay; return this; } - + private int _unacceptableMessageLimit; - + /// /// Sets the limit for the number of unacceptable messages that can be received before the channel stops processing. /// Unacceptable messages are those that cannot be deserialized or are malformed. This limit prevents endless processing of bad messages. @@ -176,9 +175,9 @@ public RedisSubscriptionBuilder SetUnacceptableMessageLimit(int unacceptableMess _unacceptableMessageLimit = unacceptableMessageLimit; return this; } - + private MessagePumpType _messagePumpType = MessagePumpType.Proactor; - + /// /// Sets the message pump type that determines how messages are processed. /// Proactor uses async/await patterns for non-blocking I/O, while Reactor uses synchronous processing. @@ -190,9 +189,9 @@ public RedisSubscriptionBuilder SetMessagePumpType(MessagePumpType messagePumpTy _messagePumpType = messagePumpType; return this; } - + private IAmAChannelFactory? _channelFactory; - + /// /// Sets a custom channel factory for creating message channels. /// Use this when you need to provide custom channel creation logic beyond the default Redis channel factory. @@ -204,9 +203,9 @@ public RedisSubscriptionBuilder SetChannelFactory(IAmAChannelFactory? channelFac _channelFactory = channelFactory; return this; } - + private OnMissingChannel _onMissingChannel = OnMissingChannel.Create; - + /// /// Sets the behavior for handling missing channels/topics in Redis. /// Determines whether to create, validate, or assume the existence of channels when they are not found. @@ -218,9 +217,9 @@ public RedisSubscriptionBuilder SetMakeChannels(OnMissingChannel onMissingChanne _onMissingChannel = onMissingChannel; return this; } - + private TimeSpan? _emptyChannelDelay; - + /// /// Sets the delay before checking for messages again when the channel is empty. /// This prevents tight polling loops and reduces load on Redis when no messages are available. @@ -232,9 +231,9 @@ public RedisSubscriptionBuilder SetEmptyChannelDelay(TimeSpan? emptyChannelDelay _emptyChannelDelay = emptyChannelDelay; return this; } - + private TimeSpan? _channelFailureDelay; - + /// /// Sets the delay before retrying channel operations after a failure. /// This provides a backoff period when channel errors occur, preventing rapid retry loops that could overwhelm the system. @@ -246,7 +245,7 @@ public RedisSubscriptionBuilder SetChannelFailureDelay(TimeSpan? channelFailureD _channelFailureDelay = channelFailureDelay; return this; } - + /// /// Builds and returns a configured instance. /// This method is called internally to create the subscription with all the configured settings @@ -260,18 +259,18 @@ internal RedisSubscription Build() { throw new ConfigurationException("Subscription name is required"); } - + if (_channelName == null) { throw new ConfigurationException("Channel name is required"); } - + if (_routingKey == null) { throw new ConfigurationException("Routing key is required"); } - - return new TmpRedisSubscription( + + return new RedisSubscription( subscriptionName: _subscriptionName, channelName: _channelName, routingKey: _routingKey, @@ -290,39 +289,4 @@ internal RedisSubscription Build() channelFailureDelay: _channelFailureDelay ); } - - private class TmpRedisSubscription( - SubscriptionName subscriptionName, - ChannelName channelName, - RoutingKey routingKey, - Type? requestType = null, - Func? getRequestType = null, - int bufferSize = 1, - int noOfPerformers = 1, - TimeSpan? timeOut = null, - int requeueCount = -1, - TimeSpan? requeueDelay = null, - int unacceptableMessageLimit = 0, - MessagePumpType messagePumpType = MessagePumpType.Proactor, - IAmAChannelFactory? channelFactory = null, - OnMissingChannel makeChannels = OnMissingChannel.Create, - TimeSpan? emptyChannelDelay = null, - TimeSpan? channelFailureDelay = null) : RedisSubscription( - subscriptionName, - channelName, - routingKey, - requestType, - getRequestType, - bufferSize, - noOfPerformers, - timeOut, - requeueCount, - requeueDelay, - unacceptableMessageLimit, - messagePumpType, - channelFactory, - makeChannels, - emptyChannelDelay, - channelFailureDelay - ); -} \ No newline at end of file +} diff --git a/src/Fluent.Brighter.RocketMQ/RocketMqSubscriptionBuilder.cs b/src/Fluent.Brighter.RocketMQ/RocketMqSubscriptionBuilder.cs index ee34281..3cfb14e 100644 --- a/src/Fluent.Brighter.RocketMQ/RocketMqSubscriptionBuilder.cs +++ b/src/Fluent.Brighter.RocketMQ/RocketMqSubscriptionBuilder.cs @@ -311,6 +311,7 @@ internal RocketSubscription Build() _requeueCount, _requeueDelay, _unacceptableMessageLimit, + null, _messagePumpType, _channelFactory, _makeChannels,