Search in sources :

Example 1 with ClientTransport

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

the class PartitionManagerService method start.

@Override
public void start(ServiceStartContext startContext) {
    final ClientTransport managementClient = managementClientInjector.getValue();
    service = new PartitionManagerImpl(memberListServiceInjector.getValue(), managementClient);
}
Also used : PartitionManagerImpl(io.zeebe.broker.clustering.management.PartitionManagerImpl) ClientTransport(io.zeebe.transport.ClientTransport)

Example 2 with ClientTransport

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

the class ClientRule method interruptBrokerConnections.

public void interruptBrokerConnections() {
    final ClientTransport transport = ((ZeebeClientImpl) client).getTransport();
    transport.interruptAllChannels();
}
Also used : ClientTransport(io.zeebe.transport.ClientTransport) ZeebeClientImpl(io.zeebe.client.impl.ZeebeClientImpl)

Example 3 with ClientTransport

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

the class ClusterManagerContextService method start.

@Override
public void start(ServiceStartContext startContext) {
    final ClientTransport clientTransport = managementClientInjector.getValue();
    final BufferingServerTransport serverTransport = managementApiTransportInjector.getValue();
    final ActorScheduler actorScheduler = startContext.getScheduler();
    final LogStreamsManager logStreamsManager = logStreamsManagerInjector.getValue();
    final WorkflowRequestMessageHandler workflowRequestMessageHandler = workflowRequestMessageHandlerInjector.getValue();
    context = new ClusterManagerContext();
    context.setGossip(gossipInjector.getValue());
    context.setActorScheduler(actorScheduler);
    context.setManagementClient(clientTransport);
    context.setReplicationClient(replicationClientInjector.getValue());
    context.setServerTransport(serverTransport);
    context.setMemberListService(memberListServiceInjector.getValue());
    context.setLogStreamsManager(logStreamsManager);
    context.setWorkflowRequestMessageHandler(workflowRequestMessageHandler);
}
Also used : ActorScheduler(io.zeebe.util.sched.ActorScheduler) WorkflowRequestMessageHandler(io.zeebe.broker.system.deployment.handler.WorkflowRequestMessageHandler) ClusterManagerContext(io.zeebe.broker.clustering.management.ClusterManagerContext) ClientTransport(io.zeebe.transport.ClientTransport) LogStreamsManager(io.zeebe.broker.logstreams.LogStreamsManager) BufferingServerTransport(io.zeebe.transport.BufferingServerTransport)

Example 4 with ClientTransport

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

the class CreateTopicTest method shouldRejectPartitionCreationAndNotBreak.

@Test
public void shouldRejectPartitionCreationAndNotBreak() {
    // given
    final ClientTransport transport = apiRule.getTransport();
    final RemoteAddress remoteAddress = transport.registerRemoteAndAwaitChannel(BROKER_MGMT_ADDRESS);
    final ClientOutput output = transport.getOutput();
    final CreatePartitionRequest partitionMessage = new CreatePartitionRequest();
    final DirectBuffer topicName = BufferUtil.wrapString("foo");
    final int partition1 = 142;
    final int partition2 = 143;
    partitionMessage.topicName(topicName);
    partitionMessage.partitionId(partition1);
    // => should create partition
    doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
    // => should be rejected/ignored
    doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
    // when creating another partition
    partitionMessage.partitionId(partition2);
    doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
    // then this should be successful (i.e. the rejected request should not have jammed the broker)
    waitUntil(() -> arePublished(partition1, partition2));
}
Also used : DirectBuffer(org.agrona.DirectBuffer) RemoteAddress(io.zeebe.transport.RemoteAddress) CreatePartitionRequest(io.zeebe.broker.clustering.management.message.CreatePartitionRequest) ClientTransport(io.zeebe.transport.ClientTransport) ClientOutput(io.zeebe.transport.ClientOutput) Test(org.junit.Test)

Example 5 with ClientTransport

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

the class ClientConfigurationTest method shouldConfigureKeepAlive.

@Test
public void shouldConfigureKeepAlive() {
    // given
    final Properties props = new Properties();
    props.put(ClientProperties.CLIENT_TCP_CHANNEL_KEEP_ALIVE_PERIOD, Long.toString(KEEP_ALIVE_TIMEOUT));
    final Duration expectedTimeout = Duration.ofMillis(KEEP_ALIVE_TIMEOUT);
    // when
    final ZeebeClient client = ZeebeClient.create(props);
    // then
    final ClientTransport transport = ((ZeebeClientImpl) client).getTransport();
    assertThat(transport.getChannelKeepAlivePeriod()).isEqualTo(expectedTimeout);
}
Also used : ZeebeClient(io.zeebe.client.ZeebeClient) Duration(java.time.Duration) Properties(java.util.Properties) ClientProperties(io.zeebe.client.ClientProperties) ClientTransport(io.zeebe.transport.ClientTransport) ZeebeClientImpl(io.zeebe.client.impl.ZeebeClientImpl) 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