You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/07/31 14:54:00 UTC

[jira] [Work logged] (BEAM-4828) Add Amazon SqsIO

     [ https://issues.apache.org/jira/browse/BEAM-4828?focusedWorklogId=129332&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-129332 ]

ASF GitHub Bot logged work on BEAM-4828:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 31/Jul/18 14:53
            Start Date: 31/Jul/18 14:53
    Worklog Time Spent: 10m 
      Work Description: JohnRudolfLewis commented on a change in pull request #6101: [BEAM-4828] Add Amazon SqsIO
URL: https://github.com/apache/beam/pull/6101#discussion_r206561144
 
 

 ##########
 File path: sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/sqs/SqsIO.java
 ##########
 @@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.aws.sqs;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import com.amazonaws.services.sqs.AmazonSQS;
+import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
+import com.amazonaws.services.sqs.model.Message;
+import com.google.auto.value.AutoValue;
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.io.aws.options.AwsOptions;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.PBegin;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PDone;
+import org.joda.time.Duration;
+
+/**
+ * An unbounded source for Amazon Simple Queue Service (SQS).
+ *
+ * <h3>Reading from an SQS queue</h3>
+ *
+ * <p>The {@link SqsIO} {@link Read} returns an unbounded {@link PCollection} of {@link
+ * com.amazonaws.services.sqs.model.Message} containing the received messages.
+ *
+ * <p>To configure an SQS source, you have to provide the queueUrl to connect to. The following
+ * example illustrates how to configure the source:
+ *
+ * <pre>{@code
+ * pipeline.apply(SqsIO.read().withQueueUrl(queueUrl))
+ * }</pre>
+ *
+ * <p>Additional configuration can be provided via {@link AwsOptions} from command line args or in
+ * code. For example, if you wanted to provide a secret access key via code:
+ *
+ * <pre>{@code
+ * PipelineOptions pipelineOptions = PipelineOptionsFactory.fromArgs(args).withValidation().create();
+ * final AwsOptions awsOptions = pipelineOptions.as(AwsOptions.class);
+ * final BasicAWSCredentials awsCreds = new BasicAWSCredentials("accesskey", "secretkey");
+ * awsOptions.setAwsCredentialsProvider(new AWSStaticCredentialsProvider(awsCreds));
+ * final Pipeline pipeline = Pipeline.create(options);
+ * }</pre>
+ *
+ * <p>For more information on the available options see {@link AwsOptions}.
+ *
+ * <h3>writing to an SQS queue</h3>
+ *
+ * <p>To configure an SQS sink, you have to provide the queueUrl to connect to. The following
+ * example illustrates how to configure the sink:
+ *
+ * <pre>{@code
+ * pipeline
+ *   .apply(...) // returns PCollection<String>
+ *   .apply(SqsIO.write().withQueueUrl(queueUrl))
+ * }</pre>
+ *
+ * <p>Additional configuration can be provided via {@link AwsOptions} from command line args or in
 
 Review comment:
   will do

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 129332)
    Time Spent: 3h 10m  (was: 3h)

> Add Amazon SqsIO
> ----------------
>
>                 Key: BEAM-4828
>                 URL: https://issues.apache.org/jira/browse/BEAM-4828
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-java-aws
>            Reporter: John Rudolf Lewis
>            Assignee: John Rudolf Lewis
>            Priority: Major
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> Add an SQS source
>  
> For people who would like to follow progress or help out: [https://github.com/JohnRudolfLewis/beam/tree/Add-SqsIO]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)