[ 
https://issues.apache.org/jira/browse/STORM-405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14076357#comment-14076357
 ] 

ASF GitHub Bot commented on STORM-405:
--------------------------------------

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

    https://github.com/apache/incubator-storm/pull/195#discussion_r15473369
  
    --- 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.
    +
    +### Specifying kafka producer properties
    +You can provide all the produce properties , see 
http://kafka.apache.org/07/configuration.html 
    --- End diff --
    
    updated


> Add kafka trident state so messages can be sent to kafka topics
> ---------------------------------------------------------------
>
>                 Key: STORM-405
>                 URL: https://issues.apache.org/jira/browse/STORM-405
>             Project: Apache Storm (Incubating)
>          Issue Type: Improvement
>    Affects Versions: 0.9.3-incubating
>            Reporter: Parth Brahmbhatt
>            Priority: Minor
>             Fix For: 0.9.3-incubating
>
>
> Currently storm has a bolt for writing to kafka but we have no implementation 
> of trident state. We need a trident state implementation that allows wrting 
> tuples directly to kafka topics as part of trident topology. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to