[Issue 53][PulsarSpout] Adds DLQ support in PulsarSpout of the Storm adapter #60
+145
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #53
Motivation
The current implementation of the Storm adapter does not utilise the dead letter queue functionality of Pulsar. Often it may be desired that when there is some error while processing a message in the Storm topology, the message be moved into the dead letter queue so that it can be handled separately. But the PulsarSpout currently keeps retrying for a while & finally just drops the message by acking it, which leads to data loss. This PR seeks to allow users of PulsarSpout to opt in to using DLQ queues for message processing failures.
Modifications
negativeAcknowledge
to thePulsarSpoutConsumer
interface & added the implementation for the same in theSpoutConsumer
class.negativeAckFailedMessages
in thePulsarSpoutConfiguration
class along with getter & setters for the same.negativeAck
in thePulsarSpout
class to negatively ack messages and send them to the DLQ.fail
method in thePulsarSpout
class to negatively acknowledge messages whennegativeAckFailedMessages
is set totrue
mapToValueAndEmit
method to throw an exception when mapping to the value fails.4.0.2
. This is required for this fix as mentioned in the following PR [fix][client] Make DeadLetterPolicy & KeySharedPolicy serializable pulsar#23718Verifying this change
This change added tests and can be verified as follows:
Tested the cases where
negativeAckFailedMessages
is set totrue
andfalse
in thePulsarSpoutTest
test class.Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
The corresponding PR in my fork: AnuragReddy2000#2