dubeejw commented on a change in pull request #241: Allow producer to batch
messages
URL:
https://github.com/apache/incubator-openwhisk-package-kafka/pull/241#discussion_r164933121
##########
File path: action/messageHubProduce.py
##########
@@ -108,6 +105,42 @@ def main(params):
return result
+def produceBatchedMessages(producer, topic, messageKey, values):
+ logging.info("Producing batched messages")
+
+ if messageKey is not None:
+ for val in values:
+ producer.send(topic, bytes(val, 'utf-8'), key=bytes(messageKey,
'utf-8'))
+ else:
+ for val in values:
+ producer.send(topic, bytes(val, 'utf-8'))
+
+ producer.flush()
Review comment:
Cannot get partition and offset now for log/return statement?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services