-
Notifications
You must be signed in to change notification settings - Fork 147
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
[aws-json] Migrate SQS SendMessageBatch #309
Conversation
for _, sendEntry := range sendEntries { | ||
msg := app.Message{MessageBody: []byte(sendEntry.MessageBody)} | ||
if len(sendEntry.MessageAttributes) > 0 { | ||
oldStyleMessageAttributes := convertToOldMessageAttributeValueStructure(sendEntry.MessageAttributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the conversion step as SendMessageV1
https://github.com/Admiral-Piett/goaws/pull/288/files#diff-2b6e3902e73e67c2bf76a6c2ee3f3cc4be55d19105a543cf7954186e99c1ef54R63
app/models/sqs.go
Outdated
entryIndex, err1 := strconv.Atoi(keySegments[1]) | ||
attributeIndex, err2 := strconv.Atoi(keySegments[3]) | ||
if err1 != nil || err2 != nil { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Hi @Admiral-Piett, could you please review this? |
There was a problem hiding this 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!
app/models/sqs.go
Outdated
entryIndex, err1 := strconv.Atoi(keySegments[1]) | ||
attributeIndex, err2 := strconv.Atoi(keySegments[3]) | ||
if err1 != nil || err2 != nil { |
There was a problem hiding this comment.
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.
6c1b4e7
to
c7aeb43
Compare
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]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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`
fixes comment
c7aeb43
to
0d467b2
Compare
@Admiral-Piett Updated! |
14290cd
into
Admiral-Piett:feature-aws-json
No description provided.