use of io.camunda.zeebe.client.api.command.ClientException in project zeebe by camunda.
the class ZeebeClientImpl method close.
@Override
public void close() {
closeables.forEach(c -> {
try {
c.close();
} catch (final IOException e) {
// ignore
}
});
executorService.shutdownNow();
try {
if (!executorService.awaitTermination(15, TimeUnit.SECONDS)) {
throw new ClientException("Timed out awaiting termination of job worker executor after 15 seconds");
}
} catch (final InterruptedException e) {
throw new ClientException("Unexpected interrupted awaiting termination of job worker executor", e);
}
channel.shutdownNow();
try {
if (!channel.awaitTermination(15, TimeUnit.SECONDS)) {
throw new ClientException("Timed out awaiting termination of in-flight request channel after 15 seconds");
}
} catch (final InterruptedException e) {
throw new ClientException("Unexpectedly interrupted awaiting termination of in-flight request channel", e);
}
}
use of io.camunda.zeebe.client.api.command.ClientException in project zeebe by camunda.
the class ActivateJobsTest method shouldRaiseExceptionOnError.
@Test
public void shouldRaiseExceptionOnError() {
// given
gatewayService.errorOnRequest(ActivateJobsRequest.class, () -> new ClientException("Invalid request"));
// when
assertThatThrownBy(() -> client.newActivateJobsCommand().jobType("foo").maxJobsToActivate(3).send().join()).isInstanceOf(ClientException.class).hasMessageContaining("Invalid request");
}
use of io.camunda.zeebe.client.api.command.ClientException in project zeebe by camunda.
the class TopologyRequestTest method shouldRaiseExceptionOnError.
@Test
public void shouldRaiseExceptionOnError() {
// given
gatewayService.errorOnRequest(TopologyRequest.class, () -> new ClientException("Invalid request"));
// when
assertThatThrownBy(() -> client.newTopologyRequest().send().join()).isInstanceOf(ClientException.class).hasMessageContaining("Invalid request");
rule.verifyDefaultRequestTimeout();
}
use of io.camunda.zeebe.client.api.command.ClientException in project zeebe by camunda.
the class DeployProcessTest method shouldRaiseExceptionOnError.
@Test
public void shouldRaiseExceptionOnError() {
// given
gatewayService.errorOnRequest(DeployProcessRequest.class, () -> new ClientException("Invalid request"));
// when
assertThatThrownBy(() -> client.newDeployCommand().addResourceStringUtf8("", "test.bpmn").send().join()).isInstanceOf(ClientException.class).hasMessageContaining("Invalid request");
}
use of io.camunda.zeebe.client.api.command.ClientException in project zeebe by camunda.
the class PublishMessageTest method shouldRaiseExceptionOnError.
@Test
public void shouldRaiseExceptionOnError() {
// given
gatewayService.errorOnRequest(PublishMessageRequest.class, () -> new ClientException("Invalid request"));
// when
assertThatThrownBy(() -> client.newPublishMessageCommand().messageName("name").correlationKey("key").messageId("foo").send().join()).isInstanceOf(ClientException.class).hasMessageContaining("Invalid request");
}
Aggregations