Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/storm/pull/1939#discussion_r101977245
--- Diff:
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/trident/TridentKafkaState.java
---
@@ -75,20 +75,29 @@ public void prepare(Properties options) {
public void updateState(List<TridentTuple> tuples, TridentCollector
collector) {
String topic = null;
try {
- List<Future<RecordMetadata>> futures = new
ArrayList<>(tuples.size());
+ long currentTime=System.currentTimeMillis();
+ int numberOfRecords = tuples.size();
+ List<Future<RecordMetadata>> futures = new
ArrayList<>(numberOfRecords);
for (TridentTuple tuple : tuples) {
topic = topicSelector.getTopic(tuple);
-
+ Object messageFromTuple =
mapper.getMessageFromTuple(tuple);
+ Object keyFromTuple = mapper.getKeyFromTuple(tuple);
+
if(topic != null) {
- Future<RecordMetadata> result = producer.send(new
ProducerRecord(topic,
- mapper.getKeyFromTuple(tuple),
mapper.getMessageFromTuple(tuple)));
- futures.add(result);
+ if(messageFromTuple!=null){
+ Future<RecordMetadata> result = producer.send(new
ProducerRecord(topic,keyFromTuple, messageFromTuple));
+ futures.add(result);
+ } else {
+ LOG.warn("skipping Message with Key "+keyFromTuple+" as
message was null");
--- End diff --
spaces between `"` and `+` / and `+` and `"`
---
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.
---