Search in sources :

Example 1 with SinglePortServerConfigurationBuilder

use of org.infinispan.server.configuration.endpoint.SinglePortServerConfigurationBuilder in project keycloak by keycloak.

the class HotRodUtils method createHotRodMapStoreServer.

/**
 * Not suitable for a production usage. Only for development and test purposes.
 * Also do not use in clustered environment.
 * @param hotRodServer HotRodServer
 * @param hotRodCacheManager DefaultCacheManager
 * @param embeddedPort int
 */
public static void createHotRodMapStoreServer(HotRodServer hotRodServer, DefaultCacheManager hotRodCacheManager, int embeddedPort) {
    HotRodServerConfigurationBuilder hotRodServerConfigurationBuilder = new HotRodServerConfigurationBuilder();
    hotRodServerConfigurationBuilder.startTransport(false);
    hotRodServerConfigurationBuilder.port(embeddedPort);
    hotRodServer.start(hotRodServerConfigurationBuilder.build(), hotRodCacheManager);
    RestServerConfigurationBuilder restServerConfigurationBuilder = new RestServerConfigurationBuilder();
    restServerConfigurationBuilder.startTransport(false);
    restServerConfigurationBuilder.port(embeddedPort);
    RestServer restServer = new RestServer();
    restServer.start(restServerConfigurationBuilder.build(), hotRodCacheManager);
    SinglePortRouteSource routeSource = new SinglePortRouteSource();
    Set<Route<? extends RouteSource, ? extends RouteDestination>> routes = new HashSet<>();
    routes.add(new Route<>(routeSource, new HotRodServerRouteDestination("hotrod", hotRodServer)));
    routes.add(new Route<>(routeSource, new RestServerRouteDestination("rest", restServer)));
    SinglePortRouterConfiguration singlePortRouter = new SinglePortServerConfigurationBuilder().port(embeddedPort).build();
    SinglePortEndpointRouter endpointServer = new SinglePortEndpointRouter(singlePortRouter);
    endpointServer.start(new RoutingTable(routes));
}
Also used : SinglePortRouteSource(org.infinispan.server.router.routes.singleport.SinglePortRouteSource) RestServerRouteDestination(org.infinispan.server.router.routes.rest.RestServerRouteDestination) HotRodServerRouteDestination(org.infinispan.server.router.routes.hotrod.HotRodServerRouteDestination) SinglePortRouterConfiguration(org.infinispan.server.router.configuration.SinglePortRouterConfiguration) RestServer(org.infinispan.rest.RestServer) RestServerConfigurationBuilder(org.infinispan.rest.configuration.RestServerConfigurationBuilder) RoutingTable(org.infinispan.server.router.RoutingTable) RouteSource(org.infinispan.server.router.routes.RouteSource) SinglePortRouteSource(org.infinispan.server.router.routes.singleport.SinglePortRouteSource) SinglePortEndpointRouter(org.infinispan.server.router.router.impl.singleport.SinglePortEndpointRouter) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) HotRodServerRouteDestination(org.infinispan.server.router.routes.hotrod.HotRodServerRouteDestination) RouteDestination(org.infinispan.server.router.routes.RouteDestination) RestServerRouteDestination(org.infinispan.server.router.routes.rest.RestServerRouteDestination) SinglePortServerConfigurationBuilder(org.infinispan.server.configuration.endpoint.SinglePortServerConfigurationBuilder) Route(org.infinispan.server.router.routes.Route) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 RestServer (org.infinispan.rest.RestServer)1 RestServerConfigurationBuilder (org.infinispan.rest.configuration.RestServerConfigurationBuilder)1 SinglePortServerConfigurationBuilder (org.infinispan.server.configuration.endpoint.SinglePortServerConfigurationBuilder)1 HotRodServerConfigurationBuilder (org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)1 RoutingTable (org.infinispan.server.router.RoutingTable)1 SinglePortRouterConfiguration (org.infinispan.server.router.configuration.SinglePortRouterConfiguration)1 SinglePortEndpointRouter (org.infinispan.server.router.router.impl.singleport.SinglePortEndpointRouter)1 Route (org.infinispan.server.router.routes.Route)1 RouteDestination (org.infinispan.server.router.routes.RouteDestination)1 RouteSource (org.infinispan.server.router.routes.RouteSource)1 HotRodServerRouteDestination (org.infinispan.server.router.routes.hotrod.HotRodServerRouteDestination)1 RestServerRouteDestination (org.infinispan.server.router.routes.rest.RestServerRouteDestination)1 SinglePortRouteSource (org.infinispan.server.router.routes.singleport.SinglePortRouteSource)1