@Validated
public interface AgentJobService
Modifier and Type | Method and Description |
---|---|
void |
changeJobStatus(@NotBlank java.lang.String jobId,
JobStatus currentJobStatus,
JobStatus newJobStatus,
java.lang.String message)
Notify the server of a change of job status.
|
void |
claimJob(@NotBlank java.lang.String jobId,
@Valid AgentClientMetadata agentClientMetadata)
Claim a given job, telling the server that this agent is about to begin execution.
|
JobSpecification |
getJobSpecification(@NotBlank java.lang.String id)
Given a job id retrieve the job specification from the server.
|
void |
handshake(@Valid AgentClientMetadata agentClientMetadata)
Perform server handshake.
|
java.lang.String |
reserveJobId(@Valid AgentJobRequest jobRequest,
@Valid AgentClientMetadata agentClientMetadata)
Request a given job id to be reserved for this job, send along the job details, to be persisted by the server.
|
JobSpecification |
resolveJobSpecification(@NotBlank java.lang.String id)
Given the parameters supplied by the job request attempt to resolve a job specification on the server.
|
JobSpecification |
resolveJobSpecificationDryRun(@Valid AgentJobRequest jobRequest)
Invoke the job specification resolution logic without persisting anything on the server.
|
void handshake(@Valid @Valid AgentClientMetadata agentClientMetadata) throws HandshakeException
agentClientMetadata
- metadata about the client making this requestHandshakeException
- if the server rejects this clientjava.lang.String reserveJobId(@Valid @Valid AgentJobRequest jobRequest, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationException, JobIdUnavailableException
jobRequest
- the job parameters and agent metadataagentClientMetadata
- metadata about the client making this requestJobReservationException
- if the server failed to fulfill this requestJobIdUnavailableException
- if the id requested has already been usedJobSpecification resolveJobSpecification(@NotBlank @NotBlank java.lang.String id) throws JobSpecificationResolutionException
id
- The id of the job to resolve a job specification forJobSpecificationResolutionException
- if the specification cannot be resolvedJobSpecification getJobSpecification(@NotBlank @NotBlank java.lang.String id) throws JobSpecificationResolutionException
id
- The id of the job to get the specification forJobSpecificationResolutionException
- if the specification cannot be retrievedJobSpecification resolveJobSpecificationDryRun(@Valid @Valid AgentJobRequest jobRequest) throws JobSpecificationResolutionException
jobRequest
- The various parameters required to perform the dry run should be contained in this requestJobSpecificationResolutionException
- When an error occurred during attempted resolutionvoid claimJob(@NotBlank @NotBlank java.lang.String jobId, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationException
jobId
- the id of the jobagentClientMetadata
- metadata for the agent claiming this jobJobReservationException
- When the the claim request fails is invalid (reasons include: job already
claimed, invalid job ID, failure to reach the servervoid changeJobStatus(@NotBlank @NotBlank java.lang.String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, java.lang.String message) throws ChangeJobStatusException
jobId
- the id of the jobcurrentJobStatus
- the expected current status of the jobnewJobStatus
- the new status of the jobmessage
- an optional message tha accompanies this change of statusChangeJobStatusException
- when the agent fails to update the job status