Search in sources :

Example 1 with ClusterCfg

use of io.camunda.zeebe.gateway.impl.configuration.ClusterCfg in project zeebe by camunda.

the class ClusteringRule method createGateway.

private Gateway createGateway() {
    final String contactPoint = NetUtil.toSocketAddressString(getBrokerCfg(0).getNetwork().getInternalApi().getAddress());
    final GatewayCfg gatewayCfg = new GatewayCfg();
    gatewayCfg.getCluster().setContactPoint(contactPoint).setClusterName(clusterName);
    gatewayCfg.getNetwork().setPort(SocketUtil.getNextAddress().getPort());
    gatewayCfg.getCluster().setPort(SocketUtil.getNextAddress().getPort());
    // temporarily increase request time out, but we should make this configurable per test
    gatewayCfg.getCluster().setRequestTimeout(Duration.ofSeconds(45));
    gatewayCfg.init();
    gatewayConfigurator.accept(gatewayCfg);
    final ClusterCfg clusterCfg = gatewayCfg.getCluster();
    // copied from StandaloneGateway
    final AtomixCluster atomixCluster = new AtomixClusterBuilder(new ClusterConfig()).withMemberId(clusterCfg.getMemberId()).withAddress(Address.from(clusterCfg.getHost(), clusterCfg.getPort())).withClusterId(clusterCfg.getClusterName()).withMembershipProvider(BootstrapDiscoveryProvider.builder().withNodes(Address.from(clusterCfg.getContactPoint())).build()).withMembershipProtocol(SwimMembershipProtocol.builder().withSyncInterval(Duration.ofSeconds(1)).build()).withMessageCompression(gatewayCfg.getCluster().getMessageCompression()).build();
    atomixCluster.start().join();
    final ActorScheduler actorScheduler = ActorScheduler.newActorScheduler().setCpuBoundActorThreadCount(1).build();
    actorScheduler.start();
    final Gateway gateway = new Gateway(gatewayCfg, atomixCluster.getMessagingService(), atomixCluster.getMembershipService(), atomixCluster.getEventService(), actorScheduler);
    closeables.manage(gateway::stop);
    closeables.manage(atomixCluster::stop);
    closeables.manage(actorScheduler::stop);
    return gateway;
}
Also used : ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) AtomixClusterBuilder(io.atomix.cluster.AtomixClusterBuilder) Gateway(io.camunda.zeebe.gateway.Gateway) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) AtomixCluster(io.atomix.cluster.AtomixCluster) ClusterConfig(io.atomix.cluster.ClusterConfig)

Example 2 with ClusterCfg

use of io.camunda.zeebe.gateway.impl.configuration.ClusterCfg in project zeebe by zeebe-io.

the class ClusteringRule method createGateway.

private Gateway createGateway() {
    final String contactPoint = NetUtil.toSocketAddressString(getBrokerCfg(0).getNetwork().getInternalApi().getAddress());
    final GatewayCfg gatewayCfg = new GatewayCfg();
    gatewayCfg.getCluster().setContactPoint(contactPoint).setClusterName(clusterName);
    gatewayCfg.getNetwork().setPort(SocketUtil.getNextAddress().getPort());
    gatewayCfg.getCluster().setPort(SocketUtil.getNextAddress().getPort());
    // temporarily increase request time out, but we should make this configurable per test
    gatewayCfg.getCluster().setRequestTimeout(Duration.ofSeconds(45));
    gatewayCfg.init();
    gatewayConfigurator.accept(gatewayCfg);
    final ClusterCfg clusterCfg = gatewayCfg.getCluster();
    // copied from StandaloneGateway
    final AtomixCluster atomixCluster = new AtomixClusterBuilder(new ClusterConfig()).withMemberId(clusterCfg.getMemberId()).withAddress(Address.from(clusterCfg.getHost(), clusterCfg.getPort())).withClusterId(clusterCfg.getClusterName()).withMembershipProvider(BootstrapDiscoveryProvider.builder().withNodes(Address.from(clusterCfg.getContactPoint())).build()).withMembershipProtocol(SwimMembershipProtocol.builder().withSyncInterval(Duration.ofSeconds(1)).build()).withMessageCompression(gatewayCfg.getCluster().getMessageCompression()).build();
    atomixCluster.start().join();
    final ActorScheduler actorScheduler = ActorScheduler.newActorScheduler().setCpuBoundActorThreadCount(1).build();
    actorScheduler.start();
    final Gateway gateway = new Gateway(gatewayCfg, atomixCluster.getMessagingService(), atomixCluster.getMembershipService(), atomixCluster.getEventService(), actorScheduler);
    closeables.manage(gateway::stop);
    closeables.manage(atomixCluster::stop);
    closeables.manage(actorScheduler::stop);
    return gateway;
}
Also used : ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) AtomixClusterBuilder(io.atomix.cluster.AtomixClusterBuilder) Gateway(io.camunda.zeebe.gateway.Gateway) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) AtomixCluster(io.atomix.cluster.AtomixCluster) ClusterConfig(io.atomix.cluster.ClusterConfig)

Example 3 with ClusterCfg

use of io.camunda.zeebe.gateway.impl.configuration.ClusterCfg in project zeebe by camunda-cloud.

the class StandaloneGatewaySecurityTest method createGatewayCfg.

private GatewayCfg createGatewayCfg() {
    final var gatewayAddress = SocketUtil.getNextAddress();
    final var clusterAddress = SocketUtil.getNextAddress();
    return new GatewayCfg().setNetwork(new NetworkCfg().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort())).setCluster(new ClusterCfg().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setSecurity(new SecurityCfg().setEnabled(true).setCertificateChainPath(certificate.certificate()).setPrivateKeyPath(certificate.privateKey())));
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) SecurityCfg(io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)

Example 4 with ClusterCfg

use of io.camunda.zeebe.gateway.impl.configuration.ClusterCfg in project zeebe by zeebe-io.

the class StandaloneGatewaySecurityTest method createGatewayCfg.

private GatewayCfg createGatewayCfg() {
    final var gatewayAddress = SocketUtil.getNextAddress();
    final var clusterAddress = SocketUtil.getNextAddress();
    return new GatewayCfg().setNetwork(new NetworkCfg().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort())).setCluster(new ClusterCfg().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setSecurity(new SecurityCfg().setEnabled(true).setCertificateChainPath(certificate.certificate()).setPrivateKeyPath(certificate.privateKey())));
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) SecurityCfg(io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)

Example 5 with ClusterCfg

use of io.camunda.zeebe.gateway.impl.configuration.ClusterCfg in project zeebe by camunda-cloud.

the class ClusteringRule method createGateway.

private Gateway createGateway() {
    final String contactPoint = NetUtil.toSocketAddressString(getBrokerCfg(0).getNetwork().getInternalApi().getAddress());
    final GatewayCfg gatewayCfg = new GatewayCfg();
    gatewayCfg.getCluster().setContactPoint(contactPoint).setClusterName(clusterName);
    gatewayCfg.getNetwork().setPort(SocketUtil.getNextAddress().getPort());
    gatewayCfg.getCluster().setPort(SocketUtil.getNextAddress().getPort());
    // temporarily increase request time out, but we should make this configurable per test
    gatewayCfg.getCluster().setRequestTimeout(Duration.ofSeconds(45));
    gatewayCfg.init();
    gatewayConfigurator.accept(gatewayCfg);
    final ClusterCfg clusterCfg = gatewayCfg.getCluster();
    // copied from StandaloneGateway
    final AtomixCluster atomixCluster = new AtomixClusterBuilder(new ClusterConfig()).withMemberId(clusterCfg.getMemberId()).withAddress(Address.from(clusterCfg.getHost(), clusterCfg.getPort())).withClusterId(clusterCfg.getClusterName()).withMembershipProvider(BootstrapDiscoveryProvider.builder().withNodes(Address.from(clusterCfg.getContactPoint())).build()).withMembershipProtocol(SwimMembershipProtocol.builder().withSyncInterval(Duration.ofSeconds(1)).build()).withMessageCompression(gatewayCfg.getCluster().getMessageCompression()).build();
    atomixCluster.start().join();
    final ActorScheduler actorScheduler = ActorScheduler.newActorScheduler().setCpuBoundActorThreadCount(1).build();
    actorScheduler.start();
    final Gateway gateway = new Gateway(gatewayCfg, atomixCluster.getMessagingService(), atomixCluster.getMembershipService(), atomixCluster.getEventService(), actorScheduler);
    closeables.manage(gateway::stop);
    closeables.manage(atomixCluster::stop);
    closeables.manage(actorScheduler::stop);
    return gateway;
}
Also used : ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) AtomixClusterBuilder(io.atomix.cluster.AtomixClusterBuilder) Gateway(io.camunda.zeebe.gateway.Gateway) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) AtomixCluster(io.atomix.cluster.AtomixCluster) ClusterConfig(io.atomix.cluster.ClusterConfig)

Aggregations

ClusterCfg (io.camunda.zeebe.gateway.impl.configuration.ClusterCfg)6 GatewayCfg (io.camunda.zeebe.gateway.impl.configuration.GatewayCfg)6 AtomixCluster (io.atomix.cluster.AtomixCluster)3 AtomixClusterBuilder (io.atomix.cluster.AtomixClusterBuilder)3 ClusterConfig (io.atomix.cluster.ClusterConfig)3 Gateway (io.camunda.zeebe.gateway.Gateway)3 NetworkCfg (io.camunda.zeebe.gateway.impl.configuration.NetworkCfg)3 SecurityCfg (io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)3 ActorScheduler (io.camunda.zeebe.util.sched.ActorScheduler)3