Interface TaskLifecycleListener

    • Method Detail

      • picked

        void picked​(@Nonnull
                    QueueShardId shardId,
                    @Nonnull
                    QueueLocation location,
                    @Nonnull
                    TaskRecord taskRecord,
                    long pickTaskTime)
        Event of task picking from the queue.

        Triggered when there is a task in the queue, which is ready for processing.

        Might be useful for monitoring problems with database performance.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        taskRecord - Raw task data.
        pickTaskTime - Time spent on picking the task from the queue in millis.
      • started

        void started​(@Nonnull
                     QueueShardId shardId,
                     @Nonnull
                     QueueLocation location,
                     @Nonnull
                     TaskRecord taskRecord)
        The start event of task processing.

        Always triggered when task was picked.

        Might be useful for updating a logging context.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        taskRecord - Raw task data.
      • executed

        void executed​(@Nonnull
                      QueueShardId shardId,
                      @Nonnull
                      QueueLocation location,
                      @Nonnull
                      TaskRecord taskRecord,
                      @Nonnull
                      TaskExecutionResult executionResult,
                      long processTaskTime)
        Event for completion of client logic when task processing.

        Always triggered when task processing has completed successfully.

        Might be useful for monitoring successful execution of client logic.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        taskRecord - Raw task data.
        executionResult - Result of task processing.
        processTaskTime - Time spent on task processing in millis, without the time for task picking from the queue.
      • crashed

        void crashed​(@Nonnull
                     QueueShardId shardId,
                     @Nonnull
                     QueueLocation location,
                     @Nonnull
                     TaskRecord taskRecord,
                     @Nullable
                     java.lang.Exception exc)
        Event for abnormal queue processing.

        Triggered when unexpected error occurs during task processing.

        Might be useful for tracking and monitoring errors in the system.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        taskRecord - Raw task data.
        exc - An error caused the crash.