KhaninArtur commented on a change in pull request #13112:
URL: https://github.com/apache/beam/pull/13112#discussion_r539479904



##########
File path: 
examples/kafka-to-pubsub/src/main/java/org/apache/beam/examples/KafkaToPubsub.java
##########
@@ -0,0 +1,229 @@
+/*
+ * 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.examples;
+
+import static org.apache.beam.examples.kafka.consumer.Utils.configureKafka;
+import static org.apache.beam.examples.kafka.consumer.Utils.configureSsl;
+import static 
org.apache.beam.examples.kafka.consumer.Utils.getKafkaCredentialsFromVault;
+import static org.apache.beam.examples.kafka.consumer.Utils.isSslSpecified;
+import static 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.beam.examples.avro.AvroDataClass;
+import org.apache.beam.examples.avro.AvroDataClassKafkaAvroDeserializer;
+import org.apache.beam.examples.options.KafkaToPubsubOptions;
+import org.apache.beam.examples.transforms.FormatTransform;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.PipelineResult;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubIO;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.transforms.Values;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The {@link KafkaToPubsub} pipeline is a streaming pipeline which ingests 
data in JSON format from
+ * Kafka, and outputs the resulting records to PubSub. Input topics, output 
topic, Bootstrap servers
+ * are specified by the user as template parameters. <br>
+ * Kafka may be configured with SASL/SCRAM security mechanism, in this case a 
Vault secret storage
+ * with credentials should be provided. URL to credentials and Vault token are 
specified by the user
+ * as template parameters.
+ *
+ * <p><b>Pipeline Requirements</b>
+ *
+ * <ul>
+ *   <li>Kafka Bootstrap Server(s).
+ *   <li>Kafka Topic(s) exists.
+ *   <li>The PubSub output topic exists.
+ *   <li>(Optional) An existing HashiCorp Vault secret storage
+ * </ul>
+ *
+ * <p><b>Example Usage</b>
+ *
+ * <pre>
+ * # Set the pipeline vars
+ * PROJECT=id-of-my-project
+ * BUCKET_NAME=my-bucket
+ *
+ * # Set containerization vars
+ * IMAGE_NAME=my-image-name
+ * TARGET_GCR_IMAGE=gcr.io/${PROJECT}/${IMAGE_NAME}
+ * BASE_CONTAINER_IMAGE=my-base-container-image
+ * TEMPLATE_PATH="gs://${BUCKET_NAME}/templates/kafka-pubsub.json"
+ *
+ * # Create bucket in the cloud storage
+ * gsutil mb gs://${BUCKET_NAME}
+ *
+ * # Go to the beam folder
+ * cd /path/to/beam
+ *
+ * <b>FLEX TEMPLATE</b>
+ * # Assemble uber-jar
+ * ./gradlew -p templates/kafka-to-pubsub clean shadowJar
+ *
+ * # Go to the template folder
+ * cd /path/to/beam/templates/kafka-to-pubsub
+ *
+ * # Build the flex template
+ * gcloud dataflow flex-template build ${TEMPLATE_PATH} \

Review comment:
       Removed 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to