use of io.zeebe.broker.Broker in project zeebe by zeebe-io.
the class ClusteringRule method startBroker.
private Broker startBroker(String configFile) {
final InputStream config = this.getClass().getClassLoader().getResourceAsStream(configFile);
final Broker broker = new Broker(config);
autoCloseableRule.manage(broker);
return broker;
}
use of io.zeebe.broker.Broker in project zeebe by zeebe-io.
the class ServicesLifecycleTest method shouldShutdownStreamProcessingBeforeLogStream.
@Test
public void shouldShutdownStreamProcessingBeforeLogStream() throws Exception {
// given
final Broker broker = brokerRule.getBroker();
final ServiceContainer serviceContainer = broker.getBrokerContext().getServiceContainer();
final String logStreamName = ClientApiRule.DEFAULT_TOPIC_NAME + "." + apiRule.getDefaultPartitionId();
final ServiceName<StreamProcessorController> streamProcessorServiceName = WorkflowQueueServiceNames.workflowInstanceStreamProcessorServiceName(logStreamName);
final ServiceName<Raft> raftServiceName = ClusterServiceNames.raftServiceName(logStreamName);
final StreamProcessorController streamProcessorController = getService(serviceContainer, streamProcessorServiceName);
// when
serviceContainer.removeService(raftServiceName).get();
// then
assertThat(!streamProcessorController.isOpened()).isTrue();
assertThat(streamProcessorController.isFailed()).isFalse();
}
use of io.zeebe.broker.Broker in project zeebe by zeebe-io.
the class ClusteringRule method restartBroker.
/**
* Restarts broker, if the broker is still running it will be closed before.
*
* Returns to the user if the broker is back in the cluster.
*
* @param socketAddress
* @return
*/
public void restartBroker(SocketAddress socketAddress) {
final Broker broker = brokers.get(socketAddress);
if (broker != null) {
stopBroker(socketAddress);
}
for (int i = 0; i < brokerAddresses.length; i++) {
if (brokerAddresses[i].equals(socketAddress)) {
brokers.put(socketAddress, startBroker(brokerConfigs[i]));
waitForInternalSystemAndReplicationFactor(replicationFactor);
break;
}
}
waitUntilBrokerIsAddedToTopology(socketAddress);
}
Aggregations