Class DeadLetterQueue


  • public class DeadLetterQueue
    extends Object
    This class is responsible for being the combination of dead letter queue and its monitor. The monitor is launched at the moment of object creation.

    Instead of storing in the dead letter queue the whole events, we store actions. Single event could carry multiple actions. This was designed this way to handle partial failures, for example, a plan cache invalidation event carries multiple plan keys, each one of them triggering the invalidation action. If only one of the actions fails, we add this action to the dead letter queue instead of adding the whole event (with all its actions). As a result, we don't process multiple times the actions that have already been successfully processed before.

    Since:
    9.5
    • Constructor Detail

      • DeadLetterQueue

        public DeadLetterQueue()
      • DeadLetterQueue

        @VisibleForTesting
        public DeadLetterQueue​(int queueSize,
                               int queueScanningIntervalSeconds,
                               int maxRetriesNumber)
    • Method Detail

      • getDeadLetterQueueMonitorJob

        @VisibleForTesting
        protected Runnable getDeadLetterQueueMonitorJob()
      • execute

        public boolean execute​(Supplier<Runnable> toWrap,
                               boolean handleByDeadLetterQueue)
        Wraps the runnable with try-catch block and returns true if the runnable was executed successfully, otherwise returns false.