@Experimental(value=SOURCE_SINK) public final class SnsIO extends java.lang.Object
PTransforms for writing to SNS.
Example usage:
PCollection<String> data = ...;
data.apply(SnsIO.<String>write()
.withTopicArn("topicArn")
.withPublishRequestBuilder(m -> PublishRequest.builder().message(m))
.withSnsClientProvider(awsCredentialsProvider, region));
As a client, you need to provide at least the following things:
By default, the output PublishResponse contains only the SNS messageId, all other
fields are null. If you need to include the full SdkHttpResponse and AwsResponseMetadata, you can call SnsIO.Write.withFullPublishResponse(). If you need the HTTP
status code only but no headers, you can use SnsIO.Write.withFullPublishResponseWithoutHeaders().
| Modifier and Type | Class and Description |
|---|---|
static class |
SnsIO.RetryConfiguration
A POJO encapsulating a configuration for retry behavior when issuing requests to SNS.
|
protected static class |
SnsIO.SnsWriteException
Exception class for SNS write exceptions.
|
static class |
SnsIO.Write<T>
Implementation of
write(). |
static class |
SnsIO.WriteAsync<T>
Deprecated.
Please use
write() to avoid the risk of data loss. |
| Constructor and Description |
|---|
SnsIO() |
| Modifier and Type | Method and Description |
|---|---|
static <T> SnsIO.Write<T> |
write() |
static <T> SnsIO.WriteAsync<T> |
writeAsync()
Deprecated.
Please use
write() to avoid the risk of data loss. |
public static <T> SnsIO.Write<T> write()
@Deprecated public static <T> SnsIO.WriteAsync<T> writeAsync()
write() to avoid the risk of data loss.