use of io.zeebe.servicecontainer.ServiceContainer in project zeebe by zeebe-io.
the class ClusterComponent method init.
@Override
public void init(final SystemContext context) {
final ServiceContainer serviceContainer = context.getServiceContainer();
final ConfigurationManager configurationManager = context.getConfigurationManager();
final TransportComponentCfg config = configurationManager.readEntry("network", TransportComponentCfg.class);
initMemberList(serviceContainer);
initGossip(serviceContainer, config);
initClusterManager(serviceContainer, config);
}
use of io.zeebe.servicecontainer.ServiceContainer in project zeebe by zeebe-io.
the class EmbeddedBrokerRule method getService.
public <S> S getService(ServiceName<S> serviceName) {
final ServiceContainer serviceContainer = broker.getBrokerContext().getServiceContainer();
final Injector<S> injector = new Injector<>();
final ServiceName<Object> accessorServiceName = ServiceName.newServiceName("serviceAccess" + serviceName.getName(), Object.class);
try {
serviceContainer.createService(accessorServiceName, new NoneService()).dependency(serviceName, injector).install().get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
serviceContainer.removeService(accessorServiceName);
return injector.getValue();
}
Aggregations