Class DurableJobsMetaData

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.DurableJobsMetaData
All Implemented Interfaces:
MetaDataProducerOutput, QMetaDataObject, QSupplementalInstanceMetaData, TopLevelMetaDataInterface, Serializable

public class DurableJobsMetaData extends Object implements QSupplementalInstanceMetaData
Instance-level settings for durable jobs (QInstance supplemental meta data named "durableJobs"). Its presence turns durable jobs on: startup validation then requires the jobs tables, a backend with CONDITIONAL_UPDATE, and every alwaysDurable process to be eligible.
See Also:
  • Field Details

  • Constructor Details

    • DurableJobsMetaData

      public DurableJobsMetaData()
  • Method Details

    • of

      public static DurableJobsMetaData of(QInstance qInstance)
      The settings on an instance, or null when durable jobs are off.
    • getName

      public String getName()
      Specified by:
      getName in interface TopLevelMetaDataInterface
    • withEligibleProcessName

      public DurableJobsMetaData withEligibleProcessName(String processName)
      Fluent adder for one eligible process name.
    • getEffectiveUploadsStorageTableName

      public String getEffectiveUploadsStorageTableName()
      The storage table uploads go to.
    • validate

      public void validate(QInstance qInstance, QInstanceValidator validator)
      Startup validation (spec section 4).
      Specified by:
      validate in interface QSupplementalInstanceMetaData
    • getStorageTableName

      public String getStorageTableName()
      Getter for storageTableName: the storage table (should be object storage) for chunk inputs, error CSVs and outputs.
    • withStorageTableName

      public DurableJobsMetaData withStorageTableName(String storageTableName)
      Fluent setter for storageTableName
    • getWorkerThreads

      public Integer getWorkerThreads()
      Getter for workerThreads: chunks this pod runs at once; 0 means this pod runs no jobs.
    • withWorkerThreads

      public DurableJobsMetaData withWorkerThreads(Integer workerThreads)
      Fluent setter for workerThreads
    • getLeaseTtlSeconds

      public Integer getLeaseTtlSeconds()
      Getter for leaseTtlSeconds: how long a chunk lease lasts without a heartbeat.
    • withLeaseTtlSeconds

      public DurableJobsMetaData withLeaseTtlSeconds(Integer leaseTtlSeconds)
      Fluent setter for leaseTtlSeconds
    • getReaperIntervalSeconds

      public Integer getReaperIntervalSeconds()
      Getter for reaperIntervalSeconds: how often each pod looks for expired leases.
    • withReaperIntervalSeconds

      public DurableJobsMetaData withReaperIntervalSeconds(Integer reaperIntervalSeconds)
      Fluent setter for reaperIntervalSeconds
    • getPollIntervalMillis

      public Integer getPollIntervalMillis()
      Getter for pollIntervalMillis: how often an idle worker looks for work (jittered).
    • withPollIntervalMillis

      public DurableJobsMetaData withPollIntervalMillis(Integer pollIntervalMillis)
      Fluent setter for pollIntervalMillis
    • getDurableThresholdRows

      public Integer getDurableThresholdRows()
      Getter for durableThresholdRows: row count above which an eligible process runs as a job.
    • withDurableThresholdRows

      public DurableJobsMetaData withDurableThresholdRows(Integer durableThresholdRows)
      Fluent setter for durableThresholdRows
    • getDefaultChunkSize

      public Integer getDefaultChunkSize()
      Getter for defaultChunkSize: rows per chunk unless the process says otherwise.
    • withDefaultChunkSize

      public DurableJobsMetaData withDefaultChunkSize(Integer defaultChunkSize)
      Fluent setter for defaultChunkSize
    • getDefaultMaxConcurrentJobsPerProcess

      public Integer getDefaultMaxConcurrentJobsPerProcess()
      Getter for defaultMaxConcurrentJobsPerProcess: running jobs per process.
    • withDefaultMaxConcurrentJobsPerProcess

      public DurableJobsMetaData withDefaultMaxConcurrentJobsPerProcess(Integer defaultMaxConcurrentJobsPerProcess)
      Fluent setter for defaultMaxConcurrentJobsPerProcess
    • getMaxActiveJobsPerUser

      public Integer getMaxActiveJobsPerUser()
      Getter for maxActiveJobsPerUser: running jobs per user; more stay QUEUED.
    • withMaxActiveJobsPerUser

      public DurableJobsMetaData withMaxActiveJobsPerUser(Integer maxActiveJobsPerUser)
      Fluent setter for maxActiveJobsPerUser
    • getMaxQueuedJobsPerUser

      public Integer getMaxQueuedJobsPerUser()
      Getter for maxQueuedJobsPerUser: queued jobs per user before a launch is refused (429).
    • withMaxQueuedJobsPerUser

      public DurableJobsMetaData withMaxQueuedJobsPerUser(Integer maxQueuedJobsPerUser)
      Fluent setter for maxQueuedJobsPerUser
    • getStallMinutes

      public Integer getStallMinutes()
      Getter for stallMinutes: RUNNING with no progress this long raises jobs.job-stalled.
    • withStallMinutes

      public DurableJobsMetaData withStallMinutes(Integer stallMinutes)
      Fluent setter for stallMinutes
    • getQueueStallMinutes

      public Integer getQueueStallMinutes()
      Getter for queueStallMinutes: QUEUED this long raises jobs.job-stalled.
    • withQueueStallMinutes

      public DurableJobsMetaData withQueueStallMinutes(Integer queueStallMinutes)
      Fluent setter for queueStallMinutes
    • getAssistantAutoStartMaxRows

      public Integer getAssistantAutoStartMaxRows()
      Getter for assistantAutoStartMaxRows: assistant jobs at or under this many rows start without confirmation; 0 means never.
    • withAssistantAutoStartMaxRows

      public DurableJobsMetaData withAssistantAutoStartMaxRows(Integer assistantAutoStartMaxRows)
      Fluent setter for assistantAutoStartMaxRows
    • getAssistantMaxActiveJobs

      public Integer getAssistantMaxActiveJobs()
      Getter for assistantMaxActiveJobs: active jobs the assistant channel may hold per user.
    • withAssistantMaxActiveJobs

      public DurableJobsMetaData withAssistantMaxActiveJobs(Integer assistantMaxActiveJobs)
      Fluent setter for assistantMaxActiveJobs
    • getScheduledRunsAsJobs

      public Boolean getScheduledRunsAsJobs()
      Getter for scheduledRunsAsJobs: eligible scheduled processes run as jobs.
    • withScheduledRunsAsJobs

      public DurableJobsMetaData withScheduledRunsAsJobs(Boolean scheduledRunsAsJobs)
      Fluent setter for scheduledRunsAsJobs
    • getScheduledJobsUserId

      public String getScheduledJobsUserId()
      Getter for scheduledJobsUserId: the user that owns jobs launched by the scheduler when the scheduler runs as the system user. The app's authentication module must be able to create an automated session for it. Without it, such scheduled runs stay inline (as before durable jobs).
    • withScheduledJobsUserId

      public DurableJobsMetaData withScheduledJobsUserId(String scheduledJobsUserId)
      Fluent setter for scheduledJobsUserId
    • getEligibleProcessNames

      public Set<String> getEligibleProcessNames()
      Getter for eligibleProcessNames: processes made eligible by name, with no code.
    • withEligibleProcessNames

      public DurableJobsMetaData withEligibleProcessNames(Set<String> eligibleProcessNames)
      Fluent setter for eligibleProcessNames
    • getPodId

      public String getPodId()
      Getter for podId: this pod's id (defaults to the host name plus a random suffix).
    • withPodId

      public DurableJobsMetaData withPodId(String podId)
      Fluent setter for podId
    • getUploadsStorageTableName

      public String getUploadsStorageTableName()
      Getter for uploadsStorageTableName: the storage table POST /uploads streams files into (defaults to storageTableName).
    • withUploadsStorageTableName

      public DurableJobsMetaData withUploadsStorageTableName(String uploadsStorageTableName)
      Fluent setter for uploadsStorageTableName
    • getUploadExpiryDays

      public Integer getUploadExpiryDays()
      Getter for uploadExpiryDays: days an upload ref stays usable (a job that uses it extends it).
    • withUploadExpiryDays

      public DurableJobsMetaData withUploadExpiryDays(Integer uploadExpiryDays)
      Fluent setter for uploadExpiryDays
    • getMaxUploadBytes

      public Long getMaxUploadBytes()
      Getter for maxUploadBytes: the largest file POST /uploads accepts.
    • withMaxUploadBytes

      public DurableJobsMetaData withMaxUploadBytes(Long maxUploadBytes)
      Fluent setter for maxUploadBytes
    • getEffectTargets

      public Map<String,QCodeReference> getEffectTargets()
      Getter for effectTargets: side-effect targets by name (EffectTarget code references); the outbox delivers to these
    • withEffectTargets

      public DurableJobsMetaData withEffectTargets(Map<String,QCodeReference> effectTargets)
      Fluent setter for effectTargets
    • getEffectMaxAttempts

      public Integer getEffectMaxAttempts()
      Getter for effectMaxAttempts: delivery attempts before an effect is FAILED
    • withEffectMaxAttempts

      public DurableJobsMetaData withEffectMaxAttempts(Integer effectMaxAttempts)
      Fluent setter for effectMaxAttempts
    • getEffectReconcileAttempts

      public Integer getEffectReconcileAttempts()
      Getter for effectReconcileAttempts: reconcile tries for an UNKNOWN effect before it is queued for review
    • withEffectReconcileAttempts

      public DurableJobsMetaData withEffectReconcileAttempts(Integer effectReconcileAttempts)
      Fluent setter for effectReconcileAttempts
    • getEffectLeaseTtlSeconds

      public Integer getEffectLeaseTtlSeconds()
      Getter for effectLeaseTtlSeconds: how long a dispatcher holds an effect while delivering it; an expired lease means the outcome is unknown
    • withEffectLeaseTtlSeconds

      public DurableJobsMetaData withEffectLeaseTtlSeconds(Integer effectLeaseTtlSeconds)
      Fluent setter for effectLeaseTtlSeconds
    • getEffectRetryBaseSeconds

      public Integer getEffectRetryBaseSeconds()
      Getter for effectRetryBaseSeconds: first retry delay for an effect; doubles per attempt (capped at 1 hour)
    • withEffectRetryBaseSeconds

      public DurableJobsMetaData withEffectRetryBaseSeconds(Integer effectRetryBaseSeconds)
      Fluent setter for effectRetryBaseSeconds
    • getEffectBatchSize

      public Integer getEffectBatchSize()
      Getter for effectBatchSize: effects one dispatcher pass claims
    • withEffectBatchSize

      public DurableJobsMetaData withEffectBatchSize(Integer effectBatchSize)
      Fluent setter for effectBatchSize
    • getEffectDispatcherThreads

      public Integer getEffectDispatcherThreads()
      Getter for effectDispatcherThreads: dispatcher threads per pod (0 = this pod delivers no effects)
    • withEffectDispatcherThreads

      public DurableJobsMetaData withEffectDispatcherThreads(Integer effectDispatcherThreads)
      Fluent setter for effectDispatcherThreads
    • getUseSkipLockedClaims

      public Boolean getUseSkipLockedClaims()
      Getter for useSkipLockedClaims: claim chunks and effects with SELECT ... FOR UPDATE SKIP LOCKED where the backend supports it (else conditional updates)
    • withUseSkipLockedClaims

      public DurableJobsMetaData withUseSkipLockedClaims(Boolean useSkipLockedClaims)
      Fluent setter for useSkipLockedClaims
    • withEffectTarget

      public DurableJobsMetaData withEffectTarget(String name, QCodeReference codeReference)
      Register a side-effect target (an EffectTarget implementation) by name.
    • getCompletionEffectProviders

      public List<QCodeReference> getCompletionEffectProviders()
      Getter for completionEffectProviders: JobCompletionEffects providers asked for job-level effects (e.g., output delivery) when a job is about to complete
    • withCompletionEffectProviders

      public DurableJobsMetaData withCompletionEffectProviders(List<QCodeReference> completionEffectProviders)
      Fluent setter for completionEffectProviders
    • withCompletionEffectProvider

      public DurableJobsMetaData withCompletionEffectProvider(QCodeReference codeReference)
      Register a JobCompletionEffects provider (job-level effects, such as delivering a job's outputs, written when a job is about to complete).
    • getLogMaxLines

      public Integer getLogMaxLines()
      Getter for logMaxLines
    • setLogMaxLines

      public void setLogMaxLines(Integer logMaxLines)
      Setter for logMaxLines
    • withLogMaxLines

      public DurableJobsMetaData withLogMaxLines(Integer logMaxLines)
      Fluent setter for logMaxLines
    • getLogRedactor

      public JobLogRedactor getLogRedactor()
      Getter for logRedactor
    • setLogRedactor

      public void setLogRedactor(JobLogRedactor logRedactor)
      Setter for logRedactor
    • withLogRedactor

      public DurableJobsMetaData withLogRedactor(JobLogRedactor logRedactor)
      Fluent setter for logRedactor