public final class SnsIO
extends java.lang.Object
Example usage:
PCollection<String> data = ...;
data.apply(SnsIO.<String>write()
.withTopicArn("topicArn")
.withPublishRequestBuilder(msg -> PublishRequest.builder().message(msg)));
At a minimum you have to provide:
AWS clients for all AWS IOs can be configured using AwsOptions
, e.g. --awsRegion=us-west-1
. AwsOptions
contain reasonable defaults based on default providers
for Region
and AwsCredentialsProvider
.
If you require more advanced configuration, you may change the ClientBuilderFactory
using AwsOptions.setClientBuilderFactory(Class)
.
Configuration for a specific IO can be overwritten using withClientConfiguration()
,
which also allows to configure the retry behavior for the respective IO.
Retries for failed requests can be configured using ClientConfiguration.Builder#retry(Consumer)
and are handled by the AWS SDK unless there's a
partial success (batch requests). The SDK uses a backoff strategy with equal jitter for computing
the delay before the next retry.
Note: Once retries are exhausted the error is surfaced to the runner which may then opt to retry the current partition in entirety or abort if the max number of retries of the runner is reached.
Modifier and Type | Class and Description |
---|---|
static class |
SnsIO.Write<T>
Implementation of
write() . |
Constructor and Description |
---|
SnsIO() |
Modifier and Type | Method and Description |
---|---|
static <T> SnsIO.Write<T> |
write() |
public static <T> SnsIO.Write<T> write()