Search in sources :

Example 1 with SocketBindingCfg

use of io.camunda.zeebe.broker.system.configuration.SocketBindingCfg in project zeebe by camunda.

the class ClusteringRule method before.

@Override
protected void before() throws IOException {
    partitionLatch = new CountDownLatch(partitionCount);
    // create brokers
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        getBroker(nodeId);
    }
    final var contactPoints = brokerCfgs.values().stream().map(BrokerCfg::getNetwork).map(NetworkCfg::getInternalApi).map(SocketBindingCfg::getAddress).map(NetUtil::toSocketAddressString).toArray(String[]::new);
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        final var brokerCfg = getBrokerCfg(nodeId);
        setInitialContactPoints(contactPoints).accept(brokerCfg);
    }
    // create gateway
    gateway = createGateway();
    gateway.start();
    // create client
    client = createClient();
    try {
        waitUntilBrokersStarted();
        waitForPartitionReplicationFactor();
        LOG.info("Full replication factor");
        waitUntilBrokersInTopology();
        LOG.info("All brokers in topology {}", getTopologyFromClient());
    } catch (final Exception e) {
        // If the previous waits timeouts, the brokers are not closed automatically.
        after();
        throw new UncheckedExecutionException("Cluster start failed", e);
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) SocketBindingCfg(io.camunda.zeebe.broker.system.configuration.SocketBindingCfg) CountDownLatch(java.util.concurrent.CountDownLatch) TimeoutException(java.util.concurrent.TimeoutException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with SocketBindingCfg

use of io.camunda.zeebe.broker.system.configuration.SocketBindingCfg in project zeebe by camunda-cloud.

the class ClusteringRule method before.

@Override
protected void before() throws IOException {
    partitionLatch = new CountDownLatch(partitionCount);
    // create brokers
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        getBroker(nodeId);
    }
    final var contactPoints = brokerCfgs.values().stream().map(BrokerCfg::getNetwork).map(NetworkCfg::getInternalApi).map(SocketBindingCfg::getAddress).map(NetUtil::toSocketAddressString).toArray(String[]::new);
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        final var brokerCfg = getBrokerCfg(nodeId);
        setInitialContactPoints(contactPoints).accept(brokerCfg);
    }
    // create gateway
    gateway = createGateway();
    gateway.start().join();
    // create client
    client = createClient();
    try {
        waitUntilBrokersStarted();
        waitForPartitionReplicationFactor();
        LOG.info("Full replication factor");
        waitUntilBrokersInTopology();
        LOG.info("All brokers in topology {}", getTopologyFromClient());
    } catch (final Exception e) {
        // If the previous waits timeouts, the brokers are not closed automatically.
        after();
        throw new UncheckedExecutionException("Cluster start failed", e);
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) SocketBindingCfg(io.camunda.zeebe.broker.system.configuration.SocketBindingCfg) CountDownLatch(java.util.concurrent.CountDownLatch) TimeoutException(java.util.concurrent.TimeoutException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with SocketBindingCfg

use of io.camunda.zeebe.broker.system.configuration.SocketBindingCfg in project zeebe by zeebe-io.

the class ClusteringRule method before.

@Override
protected void before() throws IOException {
    partitionLatch = new CountDownLatch(partitionCount);
    // create brokers
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        getBroker(nodeId);
    }
    final var contactPoints = brokerCfgs.values().stream().map(BrokerCfg::getNetwork).map(NetworkCfg::getInternalApi).map(SocketBindingCfg::getAddress).map(NetUtil::toSocketAddressString).toArray(String[]::new);
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        final var brokerCfg = getBrokerCfg(nodeId);
        setInitialContactPoints(contactPoints).accept(brokerCfg);
    }
    // create gateway
    gateway = createGateway();
    gateway.start().join();
    // create client
    client = createClient();
    try {
        waitUntilBrokersStarted();
        waitForPartitionReplicationFactor();
        LOG.info("Full replication factor");
        waitUntilBrokersInTopology();
        LOG.info("All brokers in topology {}", getTopologyFromClient());
    } catch (final Exception e) {
        // If the previous waits timeouts, the brokers are not closed automatically.
        after();
        throw new UncheckedExecutionException("Cluster start failed", e);
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) SocketBindingCfg(io.camunda.zeebe.broker.system.configuration.SocketBindingCfg) CountDownLatch(java.util.concurrent.CountDownLatch) TimeoutException(java.util.concurrent.TimeoutException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

BrokerCfg (io.camunda.zeebe.broker.system.configuration.BrokerCfg)3 SocketBindingCfg (io.camunda.zeebe.broker.system.configuration.SocketBindingCfg)3 UncheckedExecutionException (io.camunda.zeebe.util.exception.UncheckedExecutionException)3 IOException (java.io.IOException)3 UncheckedIOException (java.io.UncheckedIOException)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 ExecutionException (java.util.concurrent.ExecutionException)3 TimeoutException (java.util.concurrent.TimeoutException)3