public BrokerFailJobRequest setErrorMessage(String errorMessage) { requestDto.setErrorMessage(errorMessage); return this; }
public JobRecord setErrorMessage(DirectBuffer buf) { return setErrorMessage(buf, 0, buf.capacity()); }
@Override public void onCommand(TypedRecord<JobRecord> command, CommandControl<JobRecord> commandControl) { final long key = command.getKey(); final JobState.State jobState = state.getState(key); if (jobState == State.ACTIVATED) { final JobRecord failedJob = state.getJob(key); failedJob.setRetries(command.getValue().getRetries()); failedJob.setErrorMessage(command.getValue().getErrorMessage()); state.fail(key, failedJob); commandControl.accept(JobIntent.FAILED, failedJob); } else if (jobState == State.ACTIVATABLE) { commandControl.reject( RejectionType.INVALID_STATE, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "must be activated first")); } else if (jobState == State.FAILED) { commandControl.reject( RejectionType.INVALID_STATE, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "is marked as failed")); } else { commandControl.reject( RejectionType.NOT_FOUND, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "does not exist")); } } }
@Override public void onCommand(TypedRecord<JobRecord> command, CommandControl<JobRecord> commandControl) { final long key = command.getKey(); final JobState.State jobState = state.getState(key); if (jobState == State.ACTIVATED) { final JobRecord failedJob = state.getJob(key); failedJob.setRetries(command.getValue().getRetries()); failedJob.setErrorMessage(command.getValue().getErrorMessage()); state.fail(key, failedJob); commandControl.accept(JobIntent.FAILED, failedJob); } else if (jobState == State.ACTIVATABLE) { commandControl.reject( RejectionType.INVALID_STATE, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "must be activated first")); } else if (jobState == State.FAILED) { commandControl.reject( RejectionType.INVALID_STATE, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "is marked as failed")); } else { commandControl.reject( RejectionType.NOT_FOUND, String.format(NOT_ACTIVATED_JOB_MESSAGE, key, "does not exist")); } } }
.setPayload(PAYLOAD_MSGPACK) .setRetries(3) .setErrorMessage("failed message") .setDeadline(1000L);
.setPayload(PAYLOAD_MSGPACK) .setRetries(3) .setErrorMessage("failed message") .setDeadline(1000L);
.setRetries(retries) .setDeadline(deadline) .setErrorMessage("failed message"); record .getHeaders()
.setRetries(retries) .setDeadline(deadline) .setErrorMessage("failed message"); record .getHeaders()