use of org.wildfly.clustering.web.routing.RoutingProvider in project wildfly by wildfly.
the class RoutingProviderServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceName name = this.getServiceName();
ServiceBuilder<?> builder = target.addService(name);
Consumer<RoutingProvider> provider = builder.provides(name);
Service service = new FunctionalService<>(provider, Function.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.wildfly.clustering.web.routing.RoutingProvider in project wildfly by wildfly.
the class UndertowDistributableServerRuntimeHandler method execute.
@Override
public void execute(OperationContext context, String serverName) {
SupplierDependency<RoutingProvider> provider = getRoutingProvider(context, serverName);
if (provider != null) {
ServiceTarget target = context.getServiceTarget();
CapabilityServiceSupport support = context.getCapabilityServiceSupport();
SupplierDependency<Server> server = new ServiceSupplierDependency<>(UndertowUnaryRequirement.SERVER.getServiceName(context, serverName));
SupplierDependency<String> route = new FunctionSupplierDependency<>(server, Server::getRoute);
Consumer<ServiceTarget> installer = new Consumer<ServiceTarget>() {
@Override
public void accept(ServiceTarget target) {
for (CapabilityServiceConfigurator configurator : provider.get().getServiceConfigurators(serverName, route)) {
configurator.configure(support).build(target).install();
}
}
};
ServiceName name = ServiceName.JBOSS.append("clustering", "web", "undertow", "routing", serverName);
provider.register(target.addService(name)).setInstance(new ChildTargetService(installer)).install();
}
}
Aggregations