Skip to content

fix(ecs-patterns): add validation for queue and queue related props#21717

Merged
mergify[bot] merged 6 commits intoaws:mainfrom
rajyan:fix/queue-processing-service-validation
Aug 30, 2022
Merged

fix(ecs-patterns): add validation for queue and queue related props#21717
mergify[bot] merged 6 commits intoaws:mainfrom
rajyan:fix/queue-processing-service-validation

Conversation

@rajyan
Copy link
Copy Markdown
Contributor

@rajyan rajyan commented Aug 23, 2022

Problem

When queue construct is set, queue related props (maxReceiveCount, visibilityTimeout, retentionPeriod) have no effect to the queue of the QueueProcessingService. I think this is a reasonable behavior, but it is difficult to notice when wrongly configured.

Fix

This pull request adds a validation to prevent from setting both queue and queue related props at the same time, and notice users the configuration error. Also, updates the param docs for this behavior.


All Submissions:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…riod, visibilityTimeout and maxReceiveCount have no effect when queue is specified.
@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Aug 23, 2022

@github-actions github-actions bot added the p2 label Aug 23, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team August 23, 2022 01:07
Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! We need tests for this change before we can provide a meaningful review.

Comment on lines +294 to +295
if (props.queue && (props.retentionPeriod || props.visibilityTimeout || props.maxReceiveCount)) {
throw new Error('retentionPeriod, visibilityTimeout and maxReceiveCount can be set only when queue is not set. Specify them in the QueueProps of the queue');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably have different error messages depending on which prop is provided that shouldn't be. It may be confusing if all are listed and a customer hasn't provided them all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much for your quick reviews!
Added some unit tests and fixed the error messages.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 24, 2022 01:39

Pull request has been modified.

@TheRealAmazonKendra
Copy link
Copy Markdown
Contributor

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 30, 2022

update

✅ Branch has been successfully updated

Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks!

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 8d27792
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 30, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 7e9bd7d into aws:main Aug 30, 2022
@rajyan rajyan deleted the fix/queue-processing-service-validation branch October 1, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants