Class SnsBatchTemplate

java.lang.Object
io.awspring.cloud.sns.core.batch.SnsBatchTemplate
All Implemented Interfaces:
SnsBatchOperations

public class SnsBatchTemplate extends Object implements SnsBatchOperations
This template simplifies batch publishing to SNS topics.
Since:
4.1.0
Author:
Matej Nedic
  • Constructor Details

  • Method Details

    • sendBatch

      public <T> BatchResult sendBatch(String topicName, Collection<Message<T>> messages)
      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 the BatchExecutionStrategy.

      Specified by:
      sendBatch in interface SnsBatchOperations
      Type Parameters:
      T - The type of the message payload
      Parameters:
      topicName - The logical name of the SNS topic
      messages - Collection of Spring messages to send
      Returns:
      BatchResult containing successful results and any errors
    • convertAndSend

      public <T> BatchResult convertAndSend(String topicName, Collection<T> payloads)
      Converts a collection of POJOs to Spring messages and sends them as a batch to the specified SNS topic.
      Specified by:
      convertAndSend in interface SnsBatchOperations
      Type Parameters:
      T - The type of the payload
      Parameters:
      topicName - The logical name of the SNS topic
      payloads - 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 of SnsNotification to Spring messages and sends them as a batch to the specified SNS topic.
      Specified by:
      sendBatchNotifications in interface SnsBatchOperations
      Type Parameters:
      T - The type of the payload
      Parameters:
      topicName - The logical name of the SNS topic
      notifications - Collection of payloads to convert and send
      Returns:
      BatchResult containing successful results and any errors