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

ISSUE-30: Support ignoring payload when not found in s3 #33

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

Damiox
Copy link
Contributor

@Damiox Damiox commented Oct 25, 2018

Added ignorePayloadNotFound optional parameter in case you want to get rid of SQS messages that do not have their corresponding payload in Amazon S3

This PR is related to issue #30

@stanpalatnik
Copy link

+1

@PaulinaSuwardi
Copy link

I think it needs to check for the ignorePayloadNotFound==true before deleting the corresponding sqs message

@Damiox
Copy link
Contributor Author

Damiox commented Oct 26, 2018

You were right @PaulinaSuwardi - I just fixed that, and added a unit test to cover that use case. Thanks!

@smart-nick
Copy link

Love the fix. Any chance this can get merged/released?

@Damiox
Copy link
Contributor Author

Damiox commented Aug 1, 2019

@hyandell @kuba-aws @troy-aws - Would it be possible to get some feedback on this please? Thanks

@adam-aws
Copy link
Contributor

adam-aws commented Aug 6, 2021

Looks like this PR has been here for a while which is unfortunate, the piece of logic it addresses has been moved to a new package https://github.com/awslabs/payload-offloading-java-common-lib-for-aws/blob/51021fcb6198c247045896cdc50bb4971eee47a4/src/main/java/software/amazon/payloadoffloading/S3BackedPayloadStore.java#L40 which should now be made there

…want to get rid of SQS messages that do not have their corresponding payload
@Damiox Damiox changed the title ISSUE-30 ISSUE-30: Support ignoring payload when not found in s3 Aug 28, 2021
@Damiox
Copy link
Contributor Author

Damiox commented Aug 28, 2021

Hi @adam-aws, I just rebased this branch with latest master which is still addressing this issue within this library so the ignored messages (e.g. payload-not-found messages) can also be excluded from the result to the caller. Please take a look at it whenever you can. Thanks

try {
originalBody = payloadStore.getOriginalPayload(largeMessagePointer);
} catch (AmazonServiceException e) {
boolean isNoSuchKeyException = ((AmazonServiceException) e.getCause()).getErrorCode().equals("NoSuchKey");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need casting here?

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 think that e.getCause() is Throwable at this point

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

6 participants