Class EnqueueParams<PayloadT>

  • Type Parameters:
    PayloadT - A type of the payload in the task

    public final class EnqueueParams<PayloadT>
    extends java.lang.Object
    Parameters with typed payload to enqueue the task
    Since:
    12.07.2017
    • Constructor Summary

      Constructors 
      Constructor Description
      EnqueueParams()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <PayloadBuilderT>
      EnqueueParams<PayloadBuilderT>
      create​(PayloadBuilderT payload)
      Create new task parameters with payload
      boolean equals​(java.lang.Object obj)  
      java.time.Duration getExecutionDelay()
      Get the task execution delay, a Duration.ZERO is the default one if not set.
      java.util.Map<java.lang.String,​java.lang.String> getExtData()
      Get the unmodifiable map of extended user-defined parameters for the task: a map where the key is the name of the user-defined column in tasks table, and the value is the value of the user-defined parameter.
      PayloadT getPayload()
      Get task payload
      int hashCode()  
      java.lang.String toString()  
      EnqueueParams<PayloadT> withExecutionDelay​(java.time.Duration executionDelay)
      Add an execution delay for the task.
      EnqueueParams<PayloadT> withExtData​(java.lang.String columnName, java.lang.String value)
      Add the external user parameter for the task.
      EnqueueParams<PayloadT> withExtData​(java.util.Map<java.lang.String,​java.lang.String> extData)
      Update the task parameters with the map of external user-defined parameters, a map where the key is the name of the user-defined column in tasks table, and the value is the value of the user-defined parameter.
      EnqueueParams<PayloadT> withPayload​(PayloadT payload)
      Add a typed payload to the task parameters
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • EnqueueParams

        public EnqueueParams()
    • Method Detail

      • create

        public static <PayloadBuilderT> EnqueueParams<PayloadBuilderT> create​(@Nonnull
                                                                              PayloadBuilderT payload)
        Create new task parameters with payload
        Type Parameters:
        PayloadBuilderT - The type of the payload in the task
        Parameters:
        payload - task payload
        Returns:
        An object with task parameters and a payload
      • withPayload

        @Nonnull
        public EnqueueParams<PayloadT> withPayload​(@Nullable
                                                   PayloadT payload)
        Add a typed payload to the task parameters
        Parameters:
        payload - Task payload
        Returns:
        A reference to the same object with added payload
      • withExecutionDelay

        @Nonnull
        public EnqueueParams<PayloadT> withExecutionDelay​(@Nonnull
                                                          java.time.Duration executionDelay)
        Add an execution delay for the task. The given task will not be executed before current date and time plus the execution delay.
        Parameters:
        executionDelay - Execution delay, Duration.ZERO if not set.
        Returns:
        A reference to the same object with execution delay set.
      • withExtData

        @Nonnull
        public EnqueueParams<PayloadT> withExtData​(@Nonnull
                                                   java.lang.String columnName,
                                                   @Nullable
                                                   java.lang.String value)
        Add the external user parameter for the task. If the column name is already present in the external user parameters, then the original value will be replaced by the new one.
        Parameters:
        columnName - The name of the user-defined column in tasks table. The column must exist in the tasks table.
        value - The value of the user-defined parameter
        Returns:
        A reference to the same object of the task parameters with external user parameter.
      • withExtData

        @Nonnull
        public EnqueueParams<PayloadT> withExtData​(@Nonnull
                                                   java.util.Map<java.lang.String,​java.lang.String> extData)
        Update the task parameters with the map of external user-defined parameters, a map where the key is the name of the user-defined column in tasks table, and the value is the value of the user-defined parameter.
        Parameters:
        extData - Map of external user-defined parameters, key is the column name in the tasks table. All elements of that collection will be added to those already present in task parameters object, the value will replace the existing value on a duplicate key.
        Returns:
        A reference to the same object of the task parameters with external user-defined parameters map.
      • getPayload

        @Nullable
        public PayloadT getPayload()
        Get task payload
        Returns:
        Typed task payload
      • getExecutionDelay

        @Nonnull
        public java.time.Duration getExecutionDelay()
        Get the task execution delay, a Duration.ZERO is the default one if not set.
        Returns:
        Task execution delay.
      • getExtData

        @Nonnull
        public java.util.Map<java.lang.String,​java.lang.String> getExtData()
        Get the unmodifiable map of extended user-defined parameters for the task: a map where the key is the name of the user-defined column in tasks table, and the value is the value of the user-defined parameter.
        Returns:
        Map of external user-defined parameters, where the key is the column name in the tasks table.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object