refactor: split High Throughput Publishing into batching and non blocking confirmation (Enterprise) - #694
Merged
Merged
Conversation
…king confirmation (Enterprise) High Throughput Publishing was configured through one flag whose meaning differed per provider. Kafka, AMQP and SQS genuinely publish without blocking on confirmation, while DBAL and Redis only coalesce sends into a single blocking round trip. The flag was also named after asynchrony, which collides with the Asynchronous attribute. Configuration is now expressed as two named mechanisms under one method, and each provider only exposes the ones it can deliver. BREAKING CHANGE: withAsyncPublishing() is replaced by withHighThroughputPublishing(); MessagePublisher::asyncPublish() is replaced by publishDeferred(); the Channel\AsyncPublishing namespace is renamed to Channel\DeliveryConfirmation. publishDeferred() is no longer available on DBAL and Redis publishers, which cannot defer confirmation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change proposed?
Warning
Breaking change with no deprecation layer, to an Enterprise feature released in 1.324.0. Every entry in the table below changes name or shape.
High Throughput Publishing is now configured as two named mechanisms — batching and non blocking confirmation — and each provider exposes only the ones it can actually deliver.
Why
One flag stood for two unrelated mechanisms, and only three of the five providers implement both. Kafka, AMQP and SQS publish without blocking on delivery confirmation. DBAL and Redis only coalesce sends into a single round trip that still blocks until the store confirms it. Configuring both groups identically promised users a guarantee two of them cannot give. The flag was also named after asynchrony, which in Ecotone already means background processing over a Message Channel — an unrelated concept.
The failure was visible in the error messages: all five adapters told users to "enable it with
withAsyncPublishing()", a method that does not exist on the channel builder they configured.Before / after
withHighThroughputPublishing($enabled, $timeout)withHighThroughputPublishing(batchPublishing:, nonBlockingConfirmation:, confirmationTimeoutInMilliseconds:)withHighThroughputPublishing()— no parameterswithAsyncPublishing()withHighThroughputPublishing()MessagePublisherasyncPublish(): FuturepublishDeferred(): FutureChannel\AsyncPublishingChannel\DeliveryConfirmationExample
Description of Changes
Not calling the method leaves publishing unchanged. Calling it enables every mechanism the provider supports; each can then be turned off by name.
What each provider does under High Throughput Publishing:
Migration notes for anyone on 1.324.0:
publishDeferred()throws on DBAL and Redis publishers. UseconvertAndSend(BatchMessage), which was already the synchronous batch path and is unchanged.AsyncPublishingRegistrybecomesPendingDeliveryRegistry,AsyncPublishingWaiterInterceptorbecomesDeliveryConfirmationInterceptor,AsyncPublishingGatewaybecomesDeferredPublishingGateway.withHighThroughputPublishing(false)changes meaning rather than failing, since the first positional parameter is nowbatchPublishing. Every other old positional call raises aTypeErrororArgumentCountError.ConfirmedDeliveryis removed. It existed only to hand DBAL and Redis an already-resolved Future.Refines #684, which introduced the feature.
Verified against Ecotone core (1362), AMQP (25), DBAL (14), SQS (8), Redis (10), Kafka (6), Symfony (46) and Laravel (42), plus PHPStan and PHP-CS-Fixer.
Drafted with /ecotone-contributor.
Pull Request Contribution Terms