Github user Parth-Brahmbhatt commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/195#discussion_r15545039
  
    --- Diff: external/storm-kafka/README.md ---
    @@ -44,6 +44,105 @@ use Kafka 0.8.1.1 built against Scala 2.10, you would 
use the following dependen
     
     Note that the ZooKeeper and log4j dependencies are excluded to prevent 
version conflicts with Storm's dependencies.
     
    +##Writing to Kafka as part of your topology
    +You can create an instance of storm.kafka.bolt.KafkaBolt and attach it as 
a component to your topology or if you 
    +are using trident you can use storm.kafka.trident.TridentState, 
storm.kafka.trident.TridentStateFactory and
    +storm.kafka.trident.TridentKafkaUpdater.
    +
    +You need to provide implementation of following 2 interfaces
    +
    +###TupleToKafkaMapper and TridentTupleToKafkaMapper
    +These interfaces have 2 methods defined:
    +
    +```java
    +    K getKeyFromTuple(Tuple/TridentTuple tuple);
    +    V getMessageFromTuple(Tuple/TridentTuple tuple);
    +```
    +
    +as the name suggests these methods are called to map a tuple to kafka key 
and kafka message. If you just want one field
    +as key and one field as value then you can use the provided 
FieldNameBasedTupleToKafkaKeyAndMessageMapper.java 
    +implementation. In the KafkaBolt the implementation always looks for a 
field with field name "key" and "message" for 
    +backward compatibility reasons. 
    +In the TridentKafkaState you can specify what is the field name for key 
and message. These should be specified while
    +constructing and instance of FieldNameBasedTupleToKafkaKeyAndMessageMapper.
    +
    +###KafkaTopicSelector and trident KafkaTopicSelector
    +This interface has only one method
    +```java
    +public interface KafkaTopicSelector {
    +    List<String> getTopics(Tuple/TridentTuple tuple);
    +}
    +```
    +The implementation of this interface should return topics to which the 
tuple's key/message mapping needs to be published 
    +You can return an empty list but null is not acceptable. If you have one 
static topic name then you can use 
    +DefaultTopicSelector.java and set the name of the topic in the constructor.
    +
    --- End diff --
    
    fixed.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to