use of io.camunda.zeebe.gateway.Gateway in project zeebe by camunda.
the class InterceptorIT method beforeEach.
@BeforeEach
void beforeEach() {
final var clusterAddress = SocketUtil.getNextAddress();
final var gatewayAddress = SocketUtil.getNextAddress();
config.getCluster().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setRequestTimeout(Duration.ofSeconds(3));
config.getNetwork().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort());
config.init();
cluster = AtomixCluster.builder().withAddress(Address.from(clusterAddress.getHostName(), clusterAddress.getPort())).build();
gateway = new Gateway(config, this::getBrokerClient, scheduler);
cluster.start().join();
scheduler.start();
// gateway is purposefully not started to allow configuration changes
}
use of io.camunda.zeebe.gateway.Gateway in project zeebe by camunda.
the class UnavailableBrokersTest method setUp.
@BeforeAll
static void setUp() throws IOException {
final NetworkCfg networkCfg = new NetworkCfg().setPort(SocketUtil.getNextAddress().getPort());
final GatewayCfg config = new GatewayCfg().setNetwork(networkCfg);
config.init(InetAddress.getLocalHost().getHostName());
cluster = AtomixCluster.builder().build();
cluster.start();
actorScheduler = ActorScheduler.newActorScheduler().build();
actorScheduler.start();
gateway = new Gateway(new GatewayCfg().setNetwork(networkCfg), cluster.getMessagingService(), cluster.getMembershipService(), cluster.getEventService(), actorScheduler);
gateway.start();
final String gatewayAddress = NetUtil.toSocketAddressString(networkCfg.toSocketAddress());
client = ZeebeClient.newClientBuilder().gatewayAddress(gatewayAddress).usePlaintext().build();
}
use of io.camunda.zeebe.gateway.Gateway 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;
}
use of io.camunda.zeebe.gateway.Gateway in project zeebe by zeebe-io.
the class InterceptorIT method beforeEach.
@BeforeEach
void beforeEach() {
final var clusterAddress = SocketUtil.getNextAddress();
final var gatewayAddress = SocketUtil.getNextAddress();
config.getCluster().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setRequestTimeout(Duration.ofSeconds(3));
config.getNetwork().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort());
config.init();
cluster = AtomixCluster.builder().withAddress(Address.from(clusterAddress.getHostName(), clusterAddress.getPort())).build();
gateway = new Gateway(config, this::getBrokerClient, scheduler);
cluster.start().join();
scheduler.start();
// gateway is purposefully not started to allow configuration changes
}
use of io.camunda.zeebe.gateway.Gateway in project zeebe by zeebe-io.
the class UnavailableBrokersTest method setUp.
@BeforeAll
static void setUp() throws IOException {
final NetworkCfg networkCfg = new NetworkCfg().setPort(SocketUtil.getNextAddress().getPort());
final GatewayCfg config = new GatewayCfg().setNetwork(networkCfg);
config.init(InetAddress.getLocalHost().getHostName());
cluster = AtomixCluster.builder().build();
cluster.start();
actorScheduler = ActorScheduler.newActorScheduler().build();
actorScheduler.start();
gateway = new Gateway(new GatewayCfg().setNetwork(networkCfg), cluster.getMessagingService(), cluster.getMembershipService(), cluster.getEventService(), actorScheduler);
gateway.start().join();
final String gatewayAddress = NetUtil.toSocketAddressString(networkCfg.toSocketAddress());
client = ZeebeClient.newClientBuilder().gatewayAddress(gatewayAddress).usePlaintext().build();
}
Aggregations