Class ImmutableJobBatchRecordValue

java.lang.Object
io.camunda.zeebe.protocol.record.value.ImmutableJobBatchRecordValue
All Implemented Interfaces:
JsonSerializable, RecordValue, JobBatchRecordValue

@ParametersAreNonnullByDefault @Immutable public final class ImmutableJobBatchRecordValue extends Object implements JobBatchRecordValue
Immutable implementation of JobBatchRecordValue.

Use the builder to create immutable instances: ImmutableJobBatchRecordValue.builder().

  • Method Details

    • getType

      public String getType()
      Specified by:
      getType in interface JobBatchRecordValue
      Returns:
      the type of the job
    • getWorker

      public String getWorker()
      Specified by:
      getWorker in interface JobBatchRecordValue
      Returns:
      the assigned worker to complete the job
    • getTimeout

      public long getTimeout()
      Specified by:
      getTimeout in interface JobBatchRecordValue
      Returns:
      the timeout (time span in milliseconds) for which a job is exclusively assigned to this worker. If the timeout is exceeded, it can happen that the job is handed to another worker and the work is performed twice.
    • getMaxJobsToActivate

      public int getMaxJobsToActivate()
      Specified by:
      getMaxJobsToActivate in interface JobBatchRecordValue
      Returns:
      the number of jobs to handle
    • getJobKeys

      public List<Long> getJobKeys()
      Specified by:
      getJobKeys in interface JobBatchRecordValue
      Returns:
      list of the keys from the jobs assigned to this batch
    • getJobs

      public List<JobRecordValue> getJobs()
      Specified by:
      getJobs in interface JobBatchRecordValue
      Returns:
      the jobs assigned to this batch
    • isTruncated

      public boolean isTruncated()
      Specified by:
      isTruncated in interface JobBatchRecordValue
      Returns:
      the broker has more JobRecords that couldn't fit in this batch
    • withType

      public final ImmutableJobBatchRecordValue withType(String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type (can be null)
      Returns:
      A modified copy of the this object
    • withWorker

      public final ImmutableJobBatchRecordValue withWorker(String value)
      Copy the current immutable object by setting a value for the worker attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for worker (can be null)
      Returns:
      A modified copy of the this object
    • withTimeout

      public final ImmutableJobBatchRecordValue withTimeout(long value)
      Copy the current immutable object by setting a value for the timeout attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for timeout
      Returns:
      A modified copy of the this object
    • withMaxJobsToActivate

      public final ImmutableJobBatchRecordValue withMaxJobsToActivate(int value)
      Copy the current immutable object by setting a value for the maxJobsToActivate attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxJobsToActivate
      Returns:
      A modified copy of the this object
    • withJobKeys

      public final ImmutableJobBatchRecordValue withJobKeys(Long... elements)
      Copy the current immutable object with elements that replace the content of jobKeys.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withJobKeys

      public final ImmutableJobBatchRecordValue withJobKeys(Iterable<? extends Long> elements)
      Copy the current immutable object with elements that replace the content of jobKeys. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of jobKeys elements to set
      Returns:
      A modified copy of this object
    • withJobs

      public final ImmutableJobBatchRecordValue withJobs(JobRecordValue... elements)
      Copy the current immutable object with elements that replace the content of jobs.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withJobs

      public final ImmutableJobBatchRecordValue withJobs(Iterable<? extends JobRecordValue> elements)
      Copy the current immutable object with elements that replace the content of jobs. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of jobs elements to set
      Returns:
      A modified copy of this object
    • withTruncated

      public final ImmutableJobBatchRecordValue withTruncated(boolean value)
      Copy the current immutable object by setting a value for the truncated attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for truncated
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableJobBatchRecordValue that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Returns a lazily computed hash code from attributes: type, worker, timeout, maxJobsToActivate, jobKeys, jobs, truncated.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value JobBatchRecordValue with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableJobBatchRecordValue copyOf(JobBatchRecordValue instance)
      Creates an immutable copy of a JobBatchRecordValue value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable JobBatchRecordValue instance
    • builder

      public static ImmutableJobBatchRecordValue.Builder builder()
      Creates a builder for ImmutableJobBatchRecordValue.
       ImmutableJobBatchRecordValue.builder()
          .withType(String | null) // nullable type
          .withWorker(String | null) // nullable worker
          .withTimeout(long) // optional timeout
          .withMaxJobsToActivate(int) // optional maxJobsToActivate
          .addJobKey|addAllJobKeys(Long) // jobKeys elements
          .addJob|addAllJobs(io.camunda.zeebe.protocol.record.value.JobRecordValue) // jobs elements
          .withTruncated(boolean) // optional truncated
          .build();
       
      Returns:
      A new ImmutableJobBatchRecordValue builder