Class SqsIO
- java.lang.Object
-
- org.apache.beam.sdk.io.aws2.sqs.SqsIO
-
@Experimental(SOURCE_SINK) public class SqsIO extends java.lang.ObjectIO to read (unbounded) from and write to SQS queues.Reading from SQS
SqsIO.Readreturns an unboundedPCollectionofSqsMessages. As minimum configuration you have to provide thequeue urlto connect to usingSqsIO.Read.withQueueUrl(String).Example usage:
PCollection<SqsMessage> output = pipeline.apply(SqsIO.read().withQueueUrl(queueUrl))Note: Currently this source does not advance watermarks when no new messages are received.
Writing to SQS
SqsIO.Writetakes aPCollectionofSendMessageRequests as input. Each request must contain thequeue url. No further configuration is required.Example usage:
PCollection<SendMessageRequest> data = ...; data.apply(SqsIO.write())Configuration of AWS clients
AWS clients for all AWS IOs can be configured using
AwsOptions, e.g.--awsRegion=us-west-1.AwsOptionscontain reasonable defaults based on default providers forRegionandAwsCredentialsProvider.If you require more advanced configuration, you may change the
ClientBuilderFactoryusingAwsOptions.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
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSqsIO.ReadAPTransformto read/receive messages from SQS.static classSqsIO.WriteAPTransformto send messages to SQS.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SqsIO.Readread()static SqsIO.Writewrite()
-
-
-
Method Detail
-
read
public static SqsIO.Read read()
-
write
public static SqsIO.Write write()
-
-