Search in sources :

Example 1 with BrokerClientImpl

use of io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl in project zeebe by camunda.

the class GatewayIntegrationTest method setup.

@Before
public void setup() {
    final GatewayCfg configuration = new GatewayCfg();
    final var brokerCfg = broker.getBrokerCfg();
    final var internalApi = brokerCfg.getNetwork().getInternalApi();
    configuration.getCluster().setHost("0.0.0.0").setPort(SocketUtil.getNextAddress().getPort()).setContactPoint(internalApi.toString()).setRequestTimeout(Duration.ofSeconds(10));
    configuration.init();
    final ControlledActorClock clock = new ControlledActorClock();
    final ClusterServices clusterServices = broker.getClusterServices();
    client = new BrokerClientImpl(configuration, clusterServices.getMessagingService(), clusterServices.getMembershipService(), clusterServices.getEventService(), clock);
}
Also used : ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) ClusterServices(io.camunda.zeebe.broker.clustering.ClusterServices) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BrokerClientImpl(io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl) Before(org.junit.Before)

Example 2 with BrokerClientImpl

use of io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl in project zeebe by zeebe-io.

the class BrokerClientTest method setUp.

@Before
public void setUp() {
    final GatewayCfg configuration = new GatewayCfg();
    configuration.getCluster().setHost("0.0.0.0").setPort(SocketUtil.getNextAddress().getPort()).setContactPoint(NetUtil.toSocketAddressString(broker.getSocketAddress())).setRequestTimeout(Duration.ofSeconds(3));
    configuration.init();
    final ControlledActorClock clock = new ControlledActorClock();
    final var stubAddress = Address.from(broker.getCurrentStubHost(), broker.getCurrentStubPort());
    final var stubNode = Node.builder().withAddress(stubAddress).build();
    final var listOfNodes = List.of(stubNode);
    atomixCluster = AtomixCluster.builder().withPort(SocketUtil.getNextAddress().getPort()).withMemberId("gateway").withClusterId("cluster").withMembershipProvider(BootstrapDiscoveryProvider.builder().withNodes(listOfNodes).build()).build();
    atomixCluster.start().join();
    client = new BrokerClientImpl(configuration, atomixCluster.getMessagingService(), atomixCluster.getMembershipService(), atomixCluster.getEventService(), clock);
    final BrokerClusterStateImpl topology = new BrokerClusterStateImpl();
    topology.addPartitionIfAbsent(START_PARTITION_ID);
    topology.setPartitionLeader(START_PARTITION_ID, 0, 1);
    topology.addBrokerIfAbsent(0);
    topology.setBrokerAddressIfPresent(0, stubAddress.toString());
    ((BrokerTopologyManagerImpl) client.getTopologyManager()).setTopology(topology);
}
Also used : BrokerTopologyManagerImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl) ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BrokerClientImpl(io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl) BrokerClusterStateImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerClusterStateImpl) Before(org.junit.Before)

Example 3 with BrokerClientImpl

use of io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl in project zeebe by camunda-cloud.

the class GatewayIntegrationTest method setup.

@Before
public void setup() {
    final GatewayCfg configuration = new GatewayCfg();
    final var brokerCfg = broker.getBrokerCfg();
    final var internalApi = brokerCfg.getNetwork().getInternalApi();
    configuration.getCluster().setHost("0.0.0.0").setPort(SocketUtil.getNextAddress().getPort()).setContactPoint(internalApi.toString()).setRequestTimeout(Duration.ofSeconds(10));
    configuration.init();
    final ControlledActorClock clock = new ControlledActorClock();
    final ClusterServices clusterServices = broker.getClusterServices();
    client = new BrokerClientImpl(configuration, clusterServices.getMessagingService(), clusterServices.getMembershipService(), clusterServices.getEventService(), clock);
}
Also used : ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) ClusterServices(io.camunda.zeebe.broker.clustering.ClusterServices) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BrokerClientImpl(io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl) Before(org.junit.Before)

Example 4 with BrokerClientImpl

use of io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl in project zeebe by camunda-cloud.

the class BrokerClientTest method setUp.

@Before
public void setUp() {
    final GatewayCfg configuration = new GatewayCfg();
    configuration.getCluster().setHost("0.0.0.0").setPort(SocketUtil.getNextAddress().getPort()).setContactPoint(NetUtil.toSocketAddressString(broker.getSocketAddress())).setRequestTimeout(Duration.ofSeconds(3));
    configuration.init();
    final ControlledActorClock clock = new ControlledActorClock();
    final var stubAddress = Address.from(broker.getCurrentStubHost(), broker.getCurrentStubPort());
    final var stubNode = Node.builder().withAddress(stubAddress).build();
    final var listOfNodes = List.of(stubNode);
    atomixCluster = AtomixCluster.builder().withPort(SocketUtil.getNextAddress().getPort()).withMemberId("gateway").withClusterId("cluster").withMembershipProvider(BootstrapDiscoveryProvider.builder().withNodes(listOfNodes).build()).build();
    atomixCluster.start().join();
    client = new BrokerClientImpl(configuration, atomixCluster.getMessagingService(), atomixCluster.getMembershipService(), atomixCluster.getEventService(), clock);
    final BrokerClusterStateImpl topology = new BrokerClusterStateImpl();
    topology.addPartitionIfAbsent(START_PARTITION_ID);
    topology.setPartitionLeader(START_PARTITION_ID, 0, 1);
    topology.addBrokerIfAbsent(0);
    topology.setBrokerAddressIfPresent(0, stubAddress.toString());
    ((BrokerTopologyManagerImpl) client.getTopologyManager()).setTopology(topology);
}
Also used : BrokerTopologyManagerImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl) ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BrokerClientImpl(io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl) BrokerClusterStateImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerClusterStateImpl) Before(org.junit.Before)

Example 5 with BrokerClientImpl

use of io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl in project zeebe by zeebe-io.

the class GatewayIntegrationTest method setup.

@Before
public void setup() {
    final GatewayCfg configuration = new GatewayCfg();
    final var brokerCfg = broker.getBrokerCfg();
    final var internalApi = brokerCfg.getNetwork().getInternalApi();
    configuration.getCluster().setHost("0.0.0.0").setPort(SocketUtil.getNextAddress().getPort()).setContactPoint(internalApi.toString()).setRequestTimeout(Duration.ofSeconds(10));
    configuration.init();
    final ControlledActorClock clock = new ControlledActorClock();
    final ClusterServices clusterServices = broker.getClusterServices();
    client = new BrokerClientImpl(configuration, clusterServices.getMessagingService(), clusterServices.getMembershipService(), clusterServices.getEventService(), clock);
}
Also used : ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) ClusterServices(io.camunda.zeebe.broker.clustering.ClusterServices) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BrokerClientImpl(io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl) Before(org.junit.Before)

Aggregations

BrokerClientImpl (io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl)6 GatewayCfg (io.camunda.zeebe.gateway.impl.configuration.GatewayCfg)6 ControlledActorClock (io.camunda.zeebe.util.sched.clock.ControlledActorClock)6 Before (org.junit.Before)6 ClusterServices (io.camunda.zeebe.broker.clustering.ClusterServices)3 BrokerClusterStateImpl (io.camunda.zeebe.gateway.impl.broker.cluster.BrokerClusterStateImpl)3 BrokerTopologyManagerImpl (io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl)3