Package com.atlassian.bamboo.grpc
Class DeadLetterQueue
- java.lang.Object
-
- com.atlassian.bamboo.grpc.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
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedBlockingQueue<Pair<Supplier<Runnable>,Integer>>
deadLetterQueue
-
Constructor Summary
Constructors Constructor Description DeadLetterQueue()
DeadLetterQueue(int queueSize, int queueScanningIntervalSeconds, int maxRetriesNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected Runnable
getDeadLetterQueueMonitorJob()
-