Search in sources :

Example 1 with BrokerTopologyManagerImpl

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

the class TopologyUpdateTest method setUp.

@Before
public void setUp() {
    members = new HashSet<>();
    topologyManager = new BrokerTopologyManagerImpl(() -> members);
    actorSchedulerRule.submitActor(topologyManager);
}
Also used : BrokerTopologyManagerImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl) Before(org.junit.Before)

Example 2 with BrokerTopologyManagerImpl

use of io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl 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 BrokerTopologyManagerImpl

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

the class TopologyUpdateTest method setUp.

@Before
public void setUp() {
    members = new HashSet<>();
    topologyManager = new BrokerTopologyManagerImpl(() -> members);
    actorSchedulerRule.submitActor(topologyManager);
}
Also used : BrokerTopologyManagerImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl) Before(org.junit.Before)

Example 4 with BrokerTopologyManagerImpl

use of io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl 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 BrokerTopologyManagerImpl

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

the class TopologyUpdateTest method setUp.

@Before
public void setUp() {
    members = new HashSet<>();
    topologyManager = new BrokerTopologyManagerImpl(() -> members);
    actorSchedulerRule.submitActor(topologyManager);
}
Also used : BrokerTopologyManagerImpl(io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl) Before(org.junit.Before)

Aggregations

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