Interface Job

  • All Known Implementing Classes:
    JobImpl

    public interface Job
    On each execution Rqueue creates a job to track it's status and execution progress.

    A job belongs to a single message poll, each message listener call creates an execution Execution and that has a detail for specific execution. Overall job status can be found using this job interface. This object is available via Header in listener method.

    • Method Detail

      • getId

        java.lang.String getId()
        Get job id corresponding to a message
        Returns:
        string job id
      • getMessageId

        java.lang.String getMessageId()
        Get message id corresponding to this job
        Returns:
        message id
      • getRqueueMessage

        RqueueMessage getRqueueMessage()
        RqueueMessage that's consumed by this job
        Returns:
        an object of RqueueMessage
      • checkIn

        void checkIn​(java.io.Serializable message)
        Checkin allows you to display a message for long running tasks, so that you can see the progress.

        The checking message could be anything given message's JSON serializable/deserializable. The message could be the current status of the job or anything else.

        NOTE: Checkin is not allowed for periodic job

        Parameters:
        message - a serializable message
      • getMessage

        java.lang.Object getMessage()
        A message that was enqueued
        Returns:
        an object could be null if deserialization fail.
      • getMessageMetadata

        MessageMetadata getMessageMetadata()
        MessageMetadata corresponding the enqueued message
        Returns:
        message metadata object
      • getStatus

        JobStatus getStatus()
        The current status of this job, the message can have different status.
        Returns:
        job status
        See Also:
        MessageMetadata
      • getException

        java.lang.Throwable getException()
        Any error detail, if it fails during execution
        Returns:
        an error object
      • getExecutionTime

        long getExecutionTime()
        Total execution time of the fetched RqueueMessages
        Returns:
        total execution time, that's sum of all listener method calls.
      • getQueueDetail

        QueueDetail getQueueDetail()
        Queue detail on which this job was executing
        Returns:
        queue detail object
      • getLatestExecution

        Execution getLatestExecution()
      • setContext

        void setContext​(Context context)
      • release

        void release​(JobStatus status,
                     java.io.Serializable why,
                     java.time.Duration duration)
      • release

        void release​(JobStatus status,
                     java.io.Serializable why)
      • delete

        void delete​(JobStatus status,
                    java.io.Serializable why)
      • isDeleted

        boolean isDeleted()
      • isReleased

        boolean isReleased()
      • hasMovedToDeadLetterQueue

        boolean hasMovedToDeadLetterQueue()
      • isDiscarded

        boolean isDiscarded()
      • getFailureCount

        int getFailureCount()