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

    https://github.com/apache/storm/pull/743#discussion_r41099133
  
    --- Diff: 
external/storm-kafka/src/jvm/storm/kafka/trident/TridentKafkaState.java ---
    @@ -72,27 +73,27 @@ public void prepare(Map stormConf) {
             Map configMap = (Map) stormConf.get(KAFKA_BROKER_PROPERTIES);
             Properties properties = new Properties();
             properties.putAll(configMap);
    -        ProducerConfig config = new ProducerConfig(properties);
    -        producer = new Producer(config);
    +        producer = new KafkaProducer(properties);
         }
     
         public void updateState(List<TridentTuple> tuples, TridentCollector 
collector) {
    -        String topic = null;
    -        for (TridentTuple tuple : tuples) {
    -            try {
    -                topic = topicSelector.getTopic(tuple);
    -
    -                if(topic != null) {
    -                    producer.send(new KeyedMessage(topic, 
mapper.getKeyFromTuple(tuple),
    -                            mapper.getMessageFromTuple(tuple)));
    -                } else {
    -                    LOG.warn("skipping key = " + 
mapper.getKeyFromTuple(tuple) + ", topic selector returned null.");
    -                }
    -            } catch (Exception ex) {
    -                String errorMsg = "Could not send message with key = " + 
mapper.getKeyFromTuple(tuple)
    -                        + " to topic = " + topic;
    -                LOG.warn(errorMsg, ex);
    -                throw new FailedException(errorMsg, ex);
    +        for (final TridentTuple tuple : tuples) {
    +            final String topic = topicSelector.getTopic(tuple);
    +            if(topic != null) {
    +                producer.send(new ProducerRecord(topic, 
mapper.getKeyFromTuple(tuple),
    --- End diff --
    
    We are moving from sync behavior to async here. Any reason for this? or 
can't we just call .get() on the send method.


---
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