Search in sources :

Example 31 with JobRecord

use of io.camunda.zeebe.protocol.impl.record.value.job.JobRecord in project zeebe by camunda.

the class BrokerFailJobRequest method toResponseDto.

@Override
protected JobRecord toResponseDto(final DirectBuffer buffer) {
    final JobRecord responseDto = new JobRecord();
    responseDto.wrap(buffer);
    return responseDto;
}
Also used : JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)

Example 32 with JobRecord

use of io.camunda.zeebe.protocol.impl.record.value.job.JobRecord in project zeebe by camunda.

the class BrokerThrowErrorRequest method toResponseDto.

@Override
protected JobRecord toResponseDto(final DirectBuffer buffer) {
    final JobRecord responseDto = new JobRecord();
    responseDto.wrap(buffer);
    return responseDto;
}
Also used : JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)

Example 33 with JobRecord

use of io.camunda.zeebe.protocol.impl.record.value.job.JobRecord in project zeebe by camunda.

the class PartitionTestClient method completeJob.

public JobRecord completeJob(final long jobKey, final JobRecord request) {
    final ExecuteCommandResponse response = executeCommandRequest(ValueType.JOB, JobIntent.COMPLETE, request, jobKey);
    assertThat(response.getRecordType()).isEqualTo(RecordType.EVENT);
    assertThat(response.getIntent()).isEqualTo(JobIntent.COMPLETED);
    return response.readInto(new JobRecord());
}
Also used : JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)

Example 34 with JobRecord

use of io.camunda.zeebe.protocol.impl.record.value.job.JobRecord in project zeebe by camunda.

the class Records method job.

public static JobRecord job(final long instanceKey, final String processId) {
    final JobRecord record = new JobRecord();
    record.setProcessInstanceKey(instanceKey);
    record.setType("test");
    record.setBpmnProcessId(processId);
    return record;
}
Also used : JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)

Example 35 with JobRecord

use of io.camunda.zeebe.protocol.impl.record.value.job.JobRecord in project zeebe by camunda.

the class ResponseMapper method toActivateJobsResponse.

public static ActivateJobsResponse toActivateJobsResponse(final long key, final JobBatchRecord brokerResponse) {
    final ActivateJobsResponse.Builder responseBuilder = ActivateJobsResponse.newBuilder();
    final Iterator<LongValue> jobKeys = brokerResponse.jobKeys().iterator();
    final Iterator<JobRecord> jobs = brokerResponse.jobs().iterator();
    while (jobKeys.hasNext() && jobs.hasNext()) {
        final LongValue jobKey = jobKeys.next();
        final JobRecord job = jobs.next();
        final ActivatedJob activatedJob = ActivatedJob.newBuilder().setKey(jobKey.getValue()).setType(bufferAsString(job.getTypeBuffer())).setBpmnProcessId(job.getBpmnProcessId()).setElementId(job.getElementId()).setProcessInstanceKey(job.getProcessInstanceKey()).setProcessDefinitionVersion(job.getProcessDefinitionVersion()).setProcessDefinitionKey(job.getProcessDefinitionKey()).setElementInstanceKey(job.getElementInstanceKey()).setCustomHeaders(bufferAsJson(job.getCustomHeadersBuffer())).setWorker(bufferAsString(job.getWorkerBuffer())).setRetries(job.getRetries()).setDeadline(job.getDeadline()).setVariables(bufferAsJson(job.getVariablesBuffer())).build();
        responseBuilder.addJobs(activatedJob);
    }
    return responseBuilder.build();
}
Also used : ActivatedJob(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivatedJob) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) ActivateJobsResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivateJobsResponse) LongValue(io.camunda.zeebe.msgpack.value.LongValue)

Aggregations

JobRecord (io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)183 Test (org.junit.Test)96 GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)15 BrokerResponse (io.camunda.zeebe.gateway.impl.broker.response.BrokerResponse)9 LongValue (io.camunda.zeebe.msgpack.value.LongValue)9 CompleteJobResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse)8 IncidentRecord (io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord)8 DirectBuffer (org.agrona.DirectBuffer)8 RecordMetadata (io.camunda.zeebe.protocol.impl.record.RecordMetadata)7 AtomicLong (java.util.concurrent.atomic.AtomicLong)7 BrokerCompleteJobRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest)6 CompleteJobRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest)6 JobState (io.camunda.zeebe.engine.state.immutable.JobState)5 State (io.camunda.zeebe.engine.state.immutable.JobState.State)5 ActivateJobsResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivateJobsResponse)5 ActivatedJob (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivatedJob)5 FailJobResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobResponse)5 UpdateJobRetriesResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesResponse)5 DeploymentRecord (io.camunda.zeebe.protocol.impl.record.value.deployment.DeploymentRecord)5 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)5