Skip to content

Conversation

@roseyang62
Copy link
Contributor

@roseyang62 roseyang62 commented Dec 2, 2025

Summary

This PR changes the AWS PubSub client to only accept queue names.
If a queue name is provided, we call GetQueueUrl during initialization and store the resolved full URL internally.

Some conventions to follow

  1. add the module name as a prefix
    • for example: add a prefix: docstore: for document store module, blobstore for Blob Store module
  2. for a test only PR, add test:
  3. for a perf improvement only PR, add perf:
  4. for a refactoring only PR, add "refactor:"

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.61%. Comparing base (6c8b9dc) to head (7698a91).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #183      +/-   ##
============================================
+ Coverage     83.59%   83.61%   +0.02%     
  Complexity       90       90              
============================================
  Files           150      150              
  Lines          8038     8051      +13     
  Branches        941      940       -1     
============================================
+ Hits           6719     6732      +13     
  Misses          875      875              
  Partials        444      444              
Flag Coverage Δ
unittests 83.61% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

throw new InvalidArgumentException("Subscription name cannot be null or empty");
}
if (!subscriptionName.startsWith("https://sqs.") || !subscriptionName.contains(".amazonaws.com/")) {
if (subscriptionName.startsWith("https://")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a random check, why would we check for https prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current logic only accepts queue names, so I'm using https:// to distinguish between URLs and names.

Or we could support both input formats:

  • If the consumer passes a queue name, we call GetQueueUrl implicitly.
  • If the consumer passes a full queue URL, it's a bit redundant for us to still call GetQueueUrl during client initialization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean why do we check only for https://, there are can n number of bad inputs, such as clients can just pass the url without https:// prefix. We can just rely on getting the exception from the AWS that the resource doesn't exist in case of bad input or maybe a regex for a valid queue name if we really need pre-validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks I understand, I removed the prefix check and let AWS handle invalid cases

}

// get the full queue URL from the queue name
this.topicName = getQueueUrl(this.topicName, sqsClient);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's call it topicUrl now, we shouldn't replace the existing topicName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, we shouldn't overwrite the original topicName. I have renamed it to topicUrl to keep both values clear

Comment on lines +461 to +465
Builder withSubscriptionUrl(String subscriptionUrl) {
this.subscriptionUrl = subscriptionUrl;
return this;
}

Copy link
Contributor Author

@roseyang62 roseyang62 Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this method because in integration tests, both topic and subscription may share the same queue. If each build() call triggers GetQueueUrl, WireMock records multiple mappings, which can cause replay mismatches.

By calling GetQueueUrl once and passing the cached URL via withSubscriptionUrl, we can avoid redundant API calls and ensure only one mapping is generated per queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants