Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IaC Error Queue not respected with Topic #1484

Open
jjnrmason opened this issue Aug 9, 2024 · 1 comment
Open

IaC Error Queue not respected with Topic #1484

jjnrmason opened this issue Aug 9, 2024 · 1 comment

Comments

@jjnrmason
Copy link

Describe the bug
Error Queue is created when DLQ is already configured on the queue.

Steps To reproduce
Create my infrastructure using CDK before I run my apps. I create

  • A single queue with an error queue associated
  • A single topic
  • A single subscription to the topic and link the queue
    This all links correctly and deploys nothing amis.

Via JustSayings configuration I do the following:

busBuilder.Subscriptions(subscriptionsBuilder => {
    subscriptionsBuilder.ForQueueUri<OrderCreatedEvent>(new Uri(builder.Configuration.GetSection("QueueConfig:OrderQueueUrl").Get<string>()!));
    subscriptionsBuilder.ForTopic<OrderCreatedEvent>(cfg => cfg
        .WithTopicName(builder.Configuration.GetSection("QueueConfig:OrderTopicName").Get<string>()!)
        .WithQueueName(builder.Configuration.GetSection("QueueConfig:OrderQueueName").Get<string>()!)); // Doesn't respect error queue
});

Setup the subscription to the topic for the message OrderCreatedEvent and add the topic name and queue name. Additionally configure the queue URI.

Expected behaviour
I would expect the library to know when providing the QueueName and topic name to load the existing queue and know it has a DLQ already.

Actual behaviour
Instead the library cretes a new DLQ and updated the queues DLQ.
Error queues

System information:

  • OS: Windows 11/AWS
  • Library Version: 7.1.2
  • .NET version: 8.0.303

Additional context
N/A

@jjnrmason
Copy link
Author

I can see that there is 2 different paths. WithQueueUri uses the QueueAddressSubscriptionBuilder and won't check for anything existing and ForTopic uses the TopicSubscriptionBuilder which does check.

TopicSubscriptionBuilder will always try to create the error queue because it'll check for sourceQueueName + "_error" (ErrorQueue).

I wonder if it'd be sensible to add WithQueueUri to the TopicSubscriptionBuilder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant