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

[aws-json] Migrate SQS SendMessageBatch #309

Conversation

kojisaikiAtSony
Copy link
Contributor

No description provided.

for _, sendEntry := range sendEntries {
msg := app.Message{MessageBody: []byte(sendEntry.MessageBody)}
if len(sendEntry.MessageAttributes) > 0 {
oldStyleMessageAttributes := convertToOldMessageAttributeValueStructure(sendEntry.MessageAttributes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 243 to 251
entryIndex, err1 := strconv.Atoi(keySegments[1])
attributeIndex, err2 := strconv.Atoi(keySegments[3])
if err1 != nil || err2 != nil {
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 case the number of key segments will be 4 (index 0 to 3) like: Entries.1.MessageAttributes.1.Name
The case that the number will be under 3 like: Entries.1.MessageBody

Copy link
Owner

Choose a reason for hiding this comment

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

Ah I see. Could you make a note of why the 2 are there? There's no way I'm going to remember that the Message Attributes have extra layers to them.

@kojisaikiAtSony
Copy link
Contributor Author

Hi @Admiral-Piett, could you please review this?

Copy link
Owner

@Admiral-Piett Admiral-Piett left a comment

Choose a reason for hiding this comment

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

Awesome! 1 tiny request for a comment in the code and all set. Thanks a ton for all your hard work here! These are heroic!

Comment on lines 243 to 251
entryIndex, err1 := strconv.Atoi(keySegments[1])
attributeIndex, err2 := strconv.Atoi(keySegments[3])
if err1 != nil || err2 != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

Ah I see. Could you make a note of why the 2 are there? There's no way I'm going to remember that the Message Attributes have extra layers to them.

@kojisaikiAtSony kojisaikiAtSony force-pushed the feature-aws-json-send-message-batch branch from 6c1b4e7 to c7aeb43 Compare July 11, 2024 03:32
@kojisaikiAtSony
Copy link
Contributor Author

Ready to merge!

}

// From like a value(Entries.1.MessageAttributes.1.Name), get the entry index and the attribute index.
entryIndex, err1 := strconv.Atoi(keySegments[1])
Copy link
Owner

Choose a reason for hiding this comment

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

I'm sorry, can we have a comment that mentions the pattern you're parsing at this index, and then another one for the index below? This will be difficult to consume and remember in the long term and the documentation is poor at describing it.

It took me a while in searching to figure out what we were going for (no fault of yours!), and I'd like to avoid that 30 minute search down the road.

Copy link
Owner

Choose a reason for hiding this comment

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

Even just something like the below would be amazing. Thank you!

Both patterns below are supported here.
// strconv.Atoi(keySegments[1] - targets the index value in pattern: `Entries.1.MessageBody`
// strconv.Atoi(keySegments[3] - targets the index value in pattern: `Entries.1.MessageAttributes.1.Name`

@kojisaikiAtSony kojisaikiAtSony force-pushed the feature-aws-json-send-message-batch branch from c7aeb43 to 0d467b2 Compare July 12, 2024 12:17
@kojisaikiAtSony
Copy link
Contributor Author

@Admiral-Piett Updated!

@Admiral-Piett Admiral-Piett merged commit 14290cd into Admiral-Piett:feature-aws-json Jul 12, 2024
2 checks passed
@kojisaikiAtSony kojisaikiAtSony deleted the feature-aws-json-send-message-batch branch July 17, 2024 04:26
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