Search in sources :

Example 1 with ThrowErrorResponse

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;
}
Also used : ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) ThrowErrorResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse) RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl)

Example 2 with ThrowErrorResponse

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;
}
Also used : ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) ThrowErrorResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse) RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl)

Example 3 with ThrowErrorResponse

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"));
}
Also used : ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) BrokerThrowErrorRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerThrowErrorRequest) ThrowErrorResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BufferUtil.wrapString(io.camunda.zeebe.util.buffer.BufferUtil.wrapString) BrokerThrowErrorRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerThrowErrorRequest) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 4 with ThrowErrorResponse

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"));
}
Also used : ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) BrokerThrowErrorRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerThrowErrorRequest) ThrowErrorResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BufferUtil.wrapString(io.camunda.zeebe.util.buffer.BufferUtil.wrapString) BrokerThrowErrorRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerThrowErrorRequest) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 5 with ThrowErrorResponse

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;
}
Also used : ThrowErrorRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest) ThrowErrorResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse) RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl)

Aggregations

ThrowErrorRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorRequest)6 ThrowErrorResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ThrowErrorResponse)6 RetriableClientFutureImpl (io.camunda.zeebe.client.impl.RetriableClientFutureImpl)3 GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)3 BrokerThrowErrorRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerThrowErrorRequest)3 JobRecord (io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)3 BufferUtil.wrapString (io.camunda.zeebe.util.buffer.BufferUtil.wrapString)3 Test (org.junit.Test)3