Search in sources :

Example 6 with ClientTransport

use of io.zeebe.transport.ClientTransport in project zeebe by zeebe-io.

the class ZeebeClientTest method shouldEstablishNewConnectionsAfterDisconnect.

@Test
public void shouldEstablishNewConnectionsAfterDisconnect() {
    // given
    final ClientTransport clientTransport = client.getTransport();
    // ensuring an open connection
    client.requestTopology().execute();
    final LoggingChannelListener channelListener = new LoggingChannelListener();
    clientTransport.registerChannelListener(channelListener).join();
    // when
    broker.closeTransport();
    System.out.println("Broker transport closed");
    broker.bindTransport();
    System.out.println("Broker transport bound");
    // then
    final TopicSubscription newSubscription = openSubscription();
    assertThat(newSubscription.isOpen()).isTrue();
    // listener invocation is asynchronous
    waitUntil(() -> channelListener.connectionState.contains(ConnectionState.CONNECTED));
    assertThat(channelListener.connectionState).last().isSameAs(ConnectionState.CONNECTED);
}
Also used : TopicSubscription(io.zeebe.client.event.TopicSubscription) ClientTransport(io.zeebe.transport.ClientTransport) Test(org.junit.Test)

Aggregations

ClientTransport (io.zeebe.transport.ClientTransport)6 Test (org.junit.Test)3 ZeebeClientImpl (io.zeebe.client.impl.ZeebeClientImpl)2 ClusterManagerContext (io.zeebe.broker.clustering.management.ClusterManagerContext)1 PartitionManagerImpl (io.zeebe.broker.clustering.management.PartitionManagerImpl)1 CreatePartitionRequest (io.zeebe.broker.clustering.management.message.CreatePartitionRequest)1 LogStreamsManager (io.zeebe.broker.logstreams.LogStreamsManager)1 WorkflowRequestMessageHandler (io.zeebe.broker.system.deployment.handler.WorkflowRequestMessageHandler)1 ClientProperties (io.zeebe.client.ClientProperties)1 ZeebeClient (io.zeebe.client.ZeebeClient)1 TopicSubscription (io.zeebe.client.event.TopicSubscription)1 BufferingServerTransport (io.zeebe.transport.BufferingServerTransport)1 ClientOutput (io.zeebe.transport.ClientOutput)1 RemoteAddress (io.zeebe.transport.RemoteAddress)1 ActorScheduler (io.zeebe.util.sched.ActorScheduler)1 Duration (java.time.Duration)1 Properties (java.util.Properties)1 DirectBuffer (org.agrona.DirectBuffer)1