-
-
Notifications
You must be signed in to change notification settings - Fork 333
Add SQS module @SnsNotificationMessage batch messages support #1133
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
Conversation
09ca31f
to
d1cdf70
Compare
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.
PR looks great @wmz7year, thanks!
Would you mind adding an entry in the docs for it?
Thanks!
@tomazfernandes I've added the doc description for this, please check it out. And if everything is okay, I'll rebase it into a single commit. |
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.
Nice work with the docs @wmz7year! Just a couple of nits and we should be ready to go.
docs/src/main/asciidoc/sqs.adoc
Outdated
|
||
The @SnsNotificationMessage annotation can be used for both single and batch message processing. | ||
|
||
For single message processing, you can use the @SnsNotificationMessage annotation as follows: |
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.
We avoid using you
and and use a more formal tone instead.
So maybe something like the @SnsNotificationMessage annotation can be used as follows:
?
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.
done
docs/src/main/asciidoc/sqs.adoc
Outdated
@@ -626,6 +631,16 @@ public void listen(@SnsNotificationMessage Pojo pojo) { | |||
} | |||
---- | |||
|
|||
For batch message processing, you can use the @SnsNotificationMessage annotation with a List<Pojo> parameter: |
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.
Same here about using you
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.
done, check it out again plz.
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.
Thanks for the PR @maxjiang153!
Looks good overall, left a couple of questions.
* SNS Message wrapper. | ||
*/ | ||
public record SnsMessageWrapper(String subject, Object message) { | ||
static Type getResolvedType(Class<?> targetClass, @Nullable Object conversionHint) { |
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.
Why is this static and not private?
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.
done
@@ -77,7 +105,7 @@ public Object fromMessage(Message<?> message, Class<?> targetClass, @Nullable Ob | |||
? ((SmartMessageConverter) this.payloadConverter).fromMessage(genericMessage, targetClass, | |||
conversionHint) | |||
: this.payloadConverter.fromMessage(genericMessage, targetClass); | |||
return new SnsMessageWrapper(jsonNode.path("Subject").asText(), convertedMessage); | |||
return convertedMessage; |
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.
Why remove the Wrapper?
While I understand we're not currently using the subject, I think it might be helpful if we eventually want to allow retrieving it.
Wdyt?
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 reason is because when NotificationMessageArgumentResolver
tries to resolving the messages, it might be a single message or a message list. So it will be more tricky to keep the wrapper when processing this situation.
So that's the reason I removed the wrapper.
Hey @maxjiang153, just a ping here to maybe try to merge this before the next version is out. Thanks! |
@tomazfernandes Hi, sorry for the late response. I was busy with other stuff. I've already updated this PR and check it again pls. |
Same thing here @maxjiang153, I added some polishing to this PR to expedite merging: #1191 Thanks again for the PR and looking forward to more! |
📢 Type of change
📜 Description
see: #1129
💡 Motivation and Context
💚 How did you test it?
📝 Checklist
🔮 Next steps