/** * Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link HttpServer} with * it's own lifecycle. * * @param server HTTP server * @param modules Additional suites if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forHttpServer(HttpServer<?, ?> server, Module... modules) { return forHttpServer(server, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} which uses the passed class to detect any modules. * * @param mainClass Any class/interface containing governator's {@link Bootstrap} annotations. * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forApplication(Class<?> mainClass, Module... modules) { return forApplication(mainClass, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} from the passed modules. * * @param modules Modules to use for the server. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forModules(Module... modules) { return forSuites(toSuite(modules)); }
/** * Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link RxServer} with * it's own lifecycle. * * @param server TCP server * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forTcpServer(RxServer<?, ?> server, Module... modules) { return forTcpServer(server, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} which combines lifecycle of the passed WebSockets {@link RxServer} with * it's own lifecycle. * * @param server WebSocket server * @param modules Additional suites if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forWebSocketServer(RxServer<? extends WebSocketFrame, ? extends WebSocketFrame> server, Module... modules) { return forWebSocketServer(server, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link UdpServer} with * it's own lifecycle. * * @param server UDP server * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forUdpServer(UdpServer<?, ?> server, Module... modules) { return forUdpServer(server, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link KaryonServer} with * it's own lifecycle. This is useful when a {@link KaryonServer} is already present and the passed * {@link Module}s are to be added to that server. * * @param server An existing karyon server * @param modules Additional modules. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forServer(KaryonServer server, Module... modules) { return forServer(server, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} that has a single TCP server instance which delegates all connection * handling to {@link ConnectionHandler}. * The {@link RxServer} is created using {@link RxNetty#newTcpServerBuilder(int, ConnectionHandler)} * * @param port Port for the server. * @param handler Connection Handler * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forTcpConnectionHandler(int port, ConnectionHandler<ByteBuf, ByteBuf> handler, Module... modules) { return forTcpConnectionHandler(port, handler, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} that has a single UDP server instance which delegates all connection * handling to {@link ConnectionHandler}. * The {@link RxServer} is created using {@link RxNetty#newUdpServerBuilder(int, ConnectionHandler)} * * @param port Port for the server. * @param handler Connection Handler * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forUdpConnectionHandler(int port, ConnectionHandler<ByteBuf, ByteBuf> handler, Module... modules) { return forUdpConnectionHandler(port, handler, toSuite(modules)); }
/** * Creates a new {@link KaryonServer} that has a single HTTP server instance which delegates all request * handling to {@link RequestHandler}. * The {@link HttpServer} is created using {@link KaryonTransport#newHttpServer(int, HttpRequestHandler)} * * @param port Port for the server. * @param handler Request Handler * @param modules Additional modules if any. * * @return {@link KaryonServer} which is to be used to start the created server. */ public static KaryonServer forRequestHandler(int port, final RequestHandler<ByteBuf, ByteBuf> handler, Module... modules) { return forRequestHandler(port, handler, toSuite(modules)); }