davidcavazos commented on a change in pull request #12188: URL: https://github.com/apache/beam/pull/12188#discussion_r457723919
########## File path: sdks/python/apache_beam/examples/kafkataxi/kafka_taxi.py ########## @@ -0,0 +1,87 @@ +# +# 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. +# + +"""An example that writes to and reads from Kafka. + + This example reads from the PubSub NYC Taxi stream described in + https://github.com/googlecodelabs/cloud-dataflow-nyc-taxi-tycoon, writes to a + given Kafka topic and reads back from the same Kafka topic. + """ + +# pytype: skip-file + +from __future__ import absolute_import + +import argparse +import logging +import typing + +import apache_beam as beam +from apache_beam.io.kafka import ReadFromKafka +from apache_beam.io.kafka import WriteToKafka +from apache_beam.options.pipeline_options import PipelineOptions +from apache_beam.options.pipeline_options import SetupOptions +from apache_beam.options.pipeline_options import StandardOptions + + +def run(argv=None): + """Main entry point; defines and runs the wordcount pipeline.""" + parser = argparse.ArgumentParser() + parser.add_argument( + '--bootstrap_servers', + dest='bootstrap_servers', + required=True, + help='Bootstrap servers for the Kafka cluster. Should be accessible by ' + 'the runner') + parser.add_argument( + '--topic', + dest='topic', + default='kafka_taxirides_realtime', + help='Kafka topic to write to and read from') + known_args, pipeline_args = parser.parse_known_args(argv) + + pipeline_options = PipelineOptions(pipeline_args) Review comment: They're not hardcoded, they are "inferred" from the `**kwargs` passed to `PipelineOptions`. ---------------------------------------------------------------- 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]
