use of io.zeebe.client.task.impl.subscription.Subscriber in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldCloseSubscriptionOnChannelClose.
@Test
public void shouldCloseSubscriptionOnChannelClose() throws InterruptedException {
// given
broker.stubTaskSubscriptionApi(123L);
final TaskSubscription subscription = clientRule.tasks().newTaskSubscription(clientRule.getDefaultTopicName()).handler((c, t) -> c.complete(t).withoutPayload().execute()).lockOwner("owner").lockTime(1000L).taskFetchSize(5).taskType("foo").open();
// when
broker.closeTransport();
// let subscriber attempt reopening
Thread.sleep(500L);
// make request time out immediately
clientRule.getClock().addTime(Duration.ofSeconds(60));
// then
TestUtil.waitUntil(() -> subscription.isClosed());
assertThat(subscription.isClosed()).isTrue();
}
Aggregations