Search code examples
apache-storm

Is there a way to get the spout msgId from within a bolt?


There is msgId inside Spout, It is used for ack and fail, The question is can I get this msgId from within the bolts?


Solution

  • I don't think you need the message id. If you're using storm-kafka, you can use the following scheme to get the partition and offset emitted as part of the tuple https://github.com/apache/storm/blob/master/external/storm-kafka/src/jvm/org/apache/storm/kafka/StringMessageAndMetadataScheme.java. You can set it as part of your SpoutConfig.

    If you're using storm-kafka-client, it emits this information by default https://github.com/apache/storm/blob/master/external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/DefaultRecordTranslator.java