use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse in project zeebe by camunda.
the class ThrowErrorCommandImpl method send.
@Override
public ZeebeFuture<Void> send() {
final ThrowErrorRequest request = builder.build();
final RetriableClientFutureImpl<Void, ThrowErrorResponse> future = new RetriableClientFutureImpl<>(retryPredicate, streamObserver -> send(request, streamObserver));
send(request, future);
return future;
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse in project zeebe by zeebe-io.
the class ThrowErrorCommandImpl method send.
@Override
public ZeebeFuture<Void> send() {
final ThrowErrorRequest request = builder.build();
final RetriableClientFutureImpl<Void, ThrowErrorResponse> future = new RetriableClientFutureImpl<>(retryPredicate, streamObserver -> send(request, streamObserver));
send(request, future);
return future;
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse in project zeebe by zeebe-io.
the class ThrowErrorTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final ThrowErrorStub stub = new ThrowErrorStub();
stub.registerWith(brokerClient);
final String errorCode = "test";
final ThrowErrorRequest request = ThrowErrorRequest.newBuilder().setJobKey(stub.getKey()).setErrorCode(errorCode).setErrorMessage("failed").build();
// when
final ThrowErrorResponse response = client.throwError(request);
// then
assertThat(response).isNotNull();
final BrokerThrowErrorRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.THROW_ERROR);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getErrorCode()).isEqualTo(errorCode);
assertThat(brokerRequestValue.getErrorMessageBuffer()).isEqualTo(wrapString("failed"));
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse in project zeebe by camunda-cloud.
the class ThrowErrorTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final ThrowErrorStub stub = new ThrowErrorStub();
stub.registerWith(brokerClient);
final String errorCode = "test";
final ThrowErrorRequest request = ThrowErrorRequest.newBuilder().setJobKey(stub.getKey()).setErrorCode(errorCode).setErrorMessage("failed").build();
// when
final ThrowErrorResponse response = client.throwError(request);
// then
assertThat(response).isNotNull();
final BrokerThrowErrorRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.THROW_ERROR);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getErrorCode()).isEqualTo(errorCode);
assertThat(brokerRequestValue.getErrorMessageBuffer()).isEqualTo(wrapString("failed"));
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse in project zeebe by camunda-cloud.
the class ThrowErrorCommandImpl method send.
@Override
public ZeebeFuture<Void> send() {
final ThrowErrorRequest request = builder.build();
final RetriableClientFutureImpl<Void, ThrowErrorResponse> future = new RetriableClientFutureImpl<>(retryPredicate, streamObserver -> send(request, streamObserver));
send(request, future);
return future;
}
Aggregations