Class ImmutableJobBatchRecordValue

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

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
    • getTenantIds

      public List<String> getTenantIds()
      Since a job batch contains many jobs, it is possible that the jobs belong to different tenants.

      This can be useful when requesting jobs for multiple tenants at once. Each of the activated jobs will be owned by the tenant that owns the corresponding process instance.

      Specified by:
      getTenantIds in interface JobBatchRecordValue
      Returns:
      the identifiers of the tenants that this job batch may contain jobs for
    • 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
    • withTenantIds

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

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

      public boolean equals(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, tenantIds.
      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
          .addTenantId|addAllTenantIds(String) // tenantIds elements
          .build();
       
      Returns:
      A new ImmutableJobBatchRecordValue builder