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

Improve handling of missing message attribute #59

Merged
merged 7 commits into from
Feb 18, 2021
Merged

Improve handling of missing message attribute #59

merged 7 commits into from
Feb 18, 2021

Conversation

adam-aws
Copy link
Contributor

@adam-aws adam-aws commented Nov 5, 2020

Description of changes:
Improve handling of missing message attribute on virtual queue receive and delete the message

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

@aws-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: 2c0eb81
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

String queueName = message.getMessageAttributes().get(VIRTUAL_QUEUE_NAME_ATTRIBUTE).getStringValue();
MessageAttributeValue messageAttributeValue = message.getMessageAttributes().get(VIRTUAL_QUEUE_NAME_ATTRIBUTE);
// Case where a message was sent with missing attribute __AmazonSQSVirtualQueuesClient.QueueName
if (messageAttributeValue == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the virtualQueue null check here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a virtualQueue null check after this, since we need to use the messageAttributeValue to get the virtualQueue

@@ -288,7 +288,13 @@ public HostQueue(String queueUrl) {
}

private void dispatchMessage(Message message) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a unit test for this change. Can we add one and make sure a mock orphanedMessageHandler is called if virtualQueue or messageAttributeValue is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added an check that orphanedMessageHandler is called

@aws-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: 9d3adeb
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@adam-aws adam-aws added this to the Release 1.2.1 milestone Feb 3, 2021
@aws-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: b10028f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@adam-aws adam-aws merged commit 63ad156 into awslabs:master Feb 18, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants