spring-cloud-aws
spring-cloud-aws copied to clipboard
Support for SnsTemplate with SnsAsyncClient
Type: Feature
Is your feature request related to a problem? Please describe. No
Describe the solution you'd like
The feature would be in the spring-cloud-aws-sns
project.
It would be nice if support for the SnsAsyncClient
in a form of a helper class like SnsTemplate
is provided.
Like the NotificationMessagingTemplate
in version 2.x.
Describe alternatives you've considered Write the class myself.
Additional context Nothing...
@bergac could you please sketch the API you have in mind?
Same as SnsTemplate
but with the SnsAsyncClient
instead of SnsClient
.
@bergac feel free to drop a PR. We will tackle async apis eventually in 3.x and this will be a good starting point.
Plus one from Spring Integration AWS.
Our SnsMessageHandler
is based on the SnsAsyncClient
and I realized that I need to use a DefaultTopicArnResolver
which is based on an SnsClient
.
Sure! I can create a new one based on SnsAsyncClient
myself, but an auto-configuration from SC-AWS still exposes only an SnsClient
.
Thank you!
@maciejwalkowiak Hello. I looked a bit into the the issue. I found that there are two places where the async processing needs to be introduced in the current flow when using the SnsAsynClient
: one when subscribing to the topic, and one when sending messages. The first can be easily modified as it calls directly the aws cdk. The other used to send a message is based on an implementation on top of the AbstractMessageChannel
which comes from spring-messaging
and has no concept of async, therefore one must choose an alternative. So far, I decided to duplicate that class (the send
method which does all the job final so I did not find a way around it) and modify as needed, but maybe there are other ways or maybe it is better to use some other library? I commited what I did in a separate in a fork, it is not complete but the functionality is implemented. In case you think this is worth pursuing and/or have suggestions I can work on it and create a PR.
@myrabetty i think it is going in the right direction but we need to think how can we do it without duplicating so much code. Maybe @MatejNedic can chime in and have a deeper look at it.
Hey, I will check this in more detail once 3.0.0 is out.