[
https://issues.apache.org/jira/browse/STORM-2915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16459657#comment-16459657
]
Stig Rohde Døssing commented on STORM-2915:
-------------------------------------------
The spout supports allowing you to implement your own failure handing, by
letting you supply an implementation of this interface
https://github.com/apache/storm/blob/master/external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpoutRetryService.java#L29.
The default implementation retries a configurable number of times, with a
configurable backoff between retries
https://github.com/apache/storm/blob/master/external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpoutRetryExponentialBackoff.java.
Take a look at the schedule method in that class, it might do what you need. If
not, please let us know what feature is missing.
Regarding the failure reason, as I mentioned that isn't supported at this time.
You can work around it though, since tuple failures are either due to
processing timeouts/lost messages, a thrown exception from a bolt causing the
worker to crash, or because a bolt failed the message explicitly. You can guard
against exceptions in your bolts, e.g. by dropping tuples to log (or some dead
letter queue) if they cause an unexpected exception, and acking them so they
are not reprocessed. Yo can also explicitly log from your bolt when you fail a
tuple with OutputCollector.fail. That would let you see the reason for failures
in your logs.
> How could I to get the fail Number in Bolt When I use Kafka Spout
> --------------------------------------------------------------------
>
> Key: STORM-2915
> URL: https://issues.apache.org/jira/browse/STORM-2915
> Project: Apache Storm
> Issue Type: New Feature
> Components: storm-kafka-client
> Affects Versions: 1.0.2, 1.1.0, 1.0.3, 1.0.4, 1.1.1, 1.0.5
> Reporter: Gergo Hong
> Priority: Minor
>
> I want to get fail num in bolt , how could I to get it?
> if fail it retry, I see This
> if (!isScheduled || retryService.isReady(msgId)) {
> final String stream = tuple instanceof KafkaTuple ? ((KafkaTuple)
> tuple).getStream() : Utils.DEFAULT_STREAM_ID;
> if (!isAtLeastOnceProcessing()) {
> if (kafkaSpoutConfig.isTupleTrackingEnforced()) {
> collector.emit(stream, tuple, msgId);
> LOG.trace("Emitted tuple [{}] for record [{}] with msgId [{}]", tuple,
> record, msgId);
> } else {
> collector.emit(stream, tuple);
> LOG.trace("Emitted tuple [{}] for record [{}]", tuple, record);
> }
> } else {
> emitted.add(msgId);
> offsetManagers.get(tp).addToEmitMsgs(msgId.offset());
> if (isScheduled) { // Was scheduled for retry and re-emitted, so remove from
> schedule.
> retryService.remove(msgId);
> }
> collector.emit(stream, tuple, msgId);
> tupleListener.onEmit(tuple, msgId);
> LOG.trace("Emitted tuple [{}] for record [{}] with msgId [{}]", tuple,
> record, msgId);
> }
> return true;
> }
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)