Search in sources :

Example 1 with PartitionBrokerRole

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.Partition.PartitionBrokerRole in project zeebe-test-container by camunda-community-hub.

the class ZeebeTopologyWaitStrategyTest method newTopology.

private static TopologyResponse newTopology(final int brokersCount, final int partitionsCount, final BiFunction<Integer, Integer, PartitionBrokerRole> partitioner) {
    final TopologyResponse.Builder topologyBuilder = TopologyResponse.newBuilder();
    for (int brokerId = 0; brokerId < brokersCount; brokerId++) {
        final BrokerInfo.Builder brokerBuilder = BrokerInfo.newBuilder().setNodeId(brokerId);
        for (int partitionId = 0; partitionId < partitionsCount; partitionId++) {
            final PartitionBrokerRole role = partitioner.apply(brokerId, partitionId);
            if (role != null) {
                brokerBuilder.addPartitions(Partition.newBuilder().setPartitionId(partitionId).setRole(role));
            }
        }
        topologyBuilder.addBrokers(brokerBuilder);
    }
    return topologyBuilder.build();
}
Also used : TopologyResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.TopologyResponse) BrokerInfo(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.BrokerInfo) PartitionBrokerRole(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.Partition.PartitionBrokerRole)

Aggregations

BrokerInfo (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.BrokerInfo)1 PartitionBrokerRole (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.Partition.PartitionBrokerRole)1 TopologyResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.TopologyResponse)1