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

Handle binary and non-jms header names #1

Closed
wants to merge 3 commits into from
Closed

Conversation

onyxraven
Copy link
Member

@onyxraven onyxraven commented Jul 7, 2022

This Pull Request uses a branch-fork from the last aws-sdk v1 tag from the upstream library. We can use this branch to maintain any fixes until all v1 uses are deprecated and removed.

These changes should be able to port forward to the v2 branch at a later date.

The JMS consumer has a couple gotchas that can cause un-rescuable issues when consuming SQS messages from outside sources.

This PR tackles the following issues:

  • SQS Header DataTypes that are not specifically handled cause an exception and are not processed.
    • This PR starts with a change to gracefully handle Binary header types by dropping them instead of throwing an exception. It is currently logging these incidents.
    • A next version of this fork will allow a 'user specified' handler to be registered to the consumer to handle these as necessary.
  • Header fields must conform to the JMS standard (java-identifier, very similar to regex \w word characters)
    • This PR starts with a change to reformat key names not allowed by JMS (non-java-identifier, nominally \W regex)
    • A next version of this fork will allow a 'user specified' handler to rename and handle these keys

Relevant upstream tickets:

Similar:

@onyxraven onyxraven self-assigned this Jul 7, 2022
</execution>
</executions>
</plugin>
<!-- <plugin>-->
Copy link
Member Author

Choose a reason for hiding this comment

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

couldn't get this plugin to behave, so commented for now

import com.amazon.sqs.javamessaging.SQSMessagingClientConstants;
import com.amazon.sqs.javamessaging.SQSQueueDestination;
import com.amazon.sqs.javamessaging.acknowledge.Acknowledger;
import com.amazonaws.services.sqs.model.MessageAttributeValue;
import org.apache.commons.logging.LogFactory;
Copy link
Member Author

@onyxraven onyxraven Jul 7, 2022

Choose a reason for hiding this comment

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

temporary for now?

} else if (BINARY.equals(type)) {
// if Binary, getBinaryValue() should be used but should require an userland mapper
// it must map to one of Boolean, Byte, Short, Integer, Long, Float, Double, and String.
// TODO userland mapper, but for now we're just going to log and skip it. The key won't be added
Copy link
Member Author

Choose a reason for hiding this comment

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

see comments

@onyxraven onyxraven marked this pull request as ready for review July 26, 2022 21:40
Copy link

@sanimalp sanimalp left a comment

Choose a reason for hiding this comment

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

This looks ok to me. I feel like we might run into some issues keeping the groupId of the artifact the same, though.

@onyxraven
Copy link
Member Author

This looks ok to me. I feel like we might run into some issues keeping the groupId of the artifact the same, though.

Agreed, I think ultimately this is a placeholder while we test, and make available for manual builds. I wouldn't publish the artifacts of this one directly.

I am going to refactor for the v2 release of the library and craft a real PR with upstream.

@onyxraven onyxraven changed the title Handle binary and wacky header names Handle binary and non-jms header names Oct 26, 2022
@onyxraven
Copy link
Member Author

Closing this for now, we have an internal branch of this, and will likely refactor for v2 instead.

@onyxraven onyxraven closed this Jan 4, 2023
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.

2 participants