Reuse existing SQS queue on install instead of failing#67
Merged
Conversation
The installer drives CloudPrint.Service.exe's `create-queue` subcommand to
provision queues. CreateQueue passed Tags inline, so re-running install against
a queue that already existed with different tags was rejected by SQS
("a queue already exists with the same name and different tags"). The
attribute-mismatch fallback also filtered on the obsolete error code
"QueueAlreadyExists", which AWSSDK.SQS v4 no longer emits — it throws
QueueNameExistsException — so that catch never fired either.
Apply tags via a separate additive TagQueue call rather than passing them to
CreateQueue (relying only on SQS's documented attribute-based create
idempotency), and catch QueueNameExistsException to reconcile attributes on a
pre-existing queue. Applies to both the main queue and its DLQ.
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.
Problem
Re-running the installer against an SQS queue that already existed failed with "a queue already exists with the same name and different tags."
The installer GUI drives
CloudPrint.Service.exe create-queueto provision queues. That subcommand passedTagsdirectly intoCreateQueue, and SQS rejects the call when a same-named queue already exists with different tags. The attribute-mismatch fallback also filtered onErrorCode == "QueueAlreadyExists"— a code AWSSDK.SQS v4 no longer emits (it throwsQueueNameExistsException) — so that recovery path never fired either.Fix (
src/CloudPrint.Service/Program.cs,create-queue)TagstoCreateQueue; apply them afterward via an additiveTagQueuecall. This relies only on SQS's documented attribute-based create idempotency.QueueNameExistsExceptionto reconcile attributes (the redrive policy) on a pre-existing queue.Testing
dotnet test— 218 tests pass (185 Service + 33 Configurator.Core), 0 failures.🤖 Generated with Claude Code