Class SnsBatchTemplate
java.lang.Object
io.awspring.cloud.sns.core.batch.SnsBatchTemplate
- All Implemented Interfaces:
SnsBatchOperations
This template simplifies batch publishing to SNS topics.
- Since:
- 4.1.0
- Author:
- Matej Nedic
-
Constructor Summary
ConstructorsConstructorDescriptionSnsBatchTemplate(SnsMessageConverter snsMessageConverter, BatchExecutionStrategy batchExecutionStrategy, TopicArnResolver topicArnResolver) -
Method Summary
Modifier and TypeMethodDescription<T> BatchResultconvertAndSend(String topicName, Collection<T> payloads) Converts a collection of POJOs to Spring messages and sends them as a batch to the specified SNS topic.<T> BatchResultsendBatch(String topicName, Collection<Message<T>> messages) Sends a batch of messages to the specified SNS topic.<T> BatchResultsendBatchNotifications(String topicName, Collection<SnsNotification<T>> notifications) Converts a collection ofSnsNotificationto Spring messages and sends them as a batch to the specified SNS topic.
-
Constructor Details
-
SnsBatchTemplate
public SnsBatchTemplate(SnsMessageConverter snsMessageConverter, BatchExecutionStrategy batchExecutionStrategy, TopicArnResolver topicArnResolver)
-
-
Method Details
-
sendBatch
Sends a batch of messages to the specified SNS topic.Converts each message using the configured
SnsMessageConverter, resolves the topic ARN, and executes the batch publish operation using theBatchExecutionStrategy.- Specified by:
sendBatchin interfaceSnsBatchOperations- Type Parameters:
T- The type of the message payload- Parameters:
topicName- The logical name of the SNS topicmessages- Collection of Spring messages to send- Returns:
- BatchResult containing successful results and any errors
-
convertAndSend
Converts a collection of POJOs to Spring messages and sends them as a batch to the specified SNS topic.- Specified by:
convertAndSendin interfaceSnsBatchOperations- Type Parameters:
T- The type of the payload- Parameters:
topicName- The logical name of the SNS topicpayloads- Collection of payloads to convert and send- Returns:
- BatchResult containing successful results and any errors
-
sendBatchNotifications
public <T> BatchResult sendBatchNotifications(String topicName, Collection<SnsNotification<T>> notifications) Converts a collection ofSnsNotificationto Spring messages and sends them as a batch to the specified SNS topic.- Specified by:
sendBatchNotificationsin interfaceSnsBatchOperations- Type Parameters:
T- The type of the payload- Parameters:
topicName- The logical name of the SNS topicnotifications- Collection of payloads to convert and send- Returns:
- BatchResult containing successful results and any errors
-