Github user hmcl commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1808#discussion_r96717295
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/bolt/KafkaBolt.java
 ---
    @@ -0,0 +1,196 @@
    +/**
    + * 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.storm.kafka.bolt;
    +
    +import org.apache.storm.task.OutputCollector;
    +import org.apache.storm.task.TopologyContext;
    +import org.apache.storm.topology.OutputFieldsDeclarer;
    +import org.apache.storm.topology.base.BaseRichBolt;
    +import org.apache.storm.tuple.Tuple;
    +import org.apache.storm.utils.TupleUtils;
    +import org.apache.kafka.clients.producer.KafkaProducer;
    +import org.apache.kafka.clients.producer.ProducerRecord;
    +import org.apache.kafka.clients.producer.RecordMetadata;
    +import org.apache.kafka.clients.producer.Callback;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.apache.storm.kafka.bolt.mapper.FieldNameBasedTupleToKafkaMapper;
    +import org.apache.storm.kafka.bolt.mapper.TupleToKafkaMapper;
    +import org.apache.storm.kafka.bolt.selector.DefaultTopicSelector;
    +import org.apache.storm.kafka.bolt.selector.KafkaTopicSelector;
    +import java.util.concurrent.Future;
    +import java.util.concurrent.ExecutionException;
    +import java.util.Map;
    +import java.util.Properties;
    +
    +
    +/**
    + * Bolt implementation that can send Tuple data to Kafka
    + * <p/>
    + * It expects the producer configuration and topic in storm config under
    + * <p/>
    + * 'kafka.broker.properties' and 'topic'
    + * <p/>
    + * respectively.
    + */
    +public class KafkaBolt<K, V> extends BaseRichBolt {
    +    private static final long serialVersionUID = -5205886631877033478L;
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(KafkaBolt.class);
    +
    +    public static final String TOPIC = "topic";
    +
    +    private KafkaProducer<K, V> producer;
    +    private OutputCollector collector;
    +    private TupleToKafkaMapper<K,V> mapper;
    +    private KafkaTopicSelector topicSelector;
    +    private Properties boltSpecfiedProperties = new Properties();
    +    private boolean fireAndForget = false;
    +    private boolean async = true;
    +
    +    public KafkaBolt() {}
    +
    +    public KafkaBolt<K,V> withTupleToKafkaMapper(TupleToKafkaMapper<K,V> 
mapper) {
    +        this.mapper = mapper;
    +        return this;
    +    }
    +
    +    public KafkaBolt<K, V> withTopicSelector(String topic) {
    +        return withTopicSelector(new DefaultTopicSelector(topic));
    +    }
    +    
    +    public KafkaBolt<K,V> withTopicSelector(KafkaTopicSelector selector) {
    +        this.topicSelector = selector;
    +        return this;
    +    }
    +
    +    public KafkaBolt<K,V> withProducerProperties(Properties 
producerProperties) {
    --- End diff --
    
    Is this method intended to set KafkaProducerProperties only? If so, 
wouldn't it be beneficial to call this method `withKafkaProducerProps`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to