public static void main(String[] args) { RxNetty.createHttpServer(8888, new RequestHandler<ByteBuf, ByteBuf>() { @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { throw new NullPointerException("doomsday"); } }).startAndWait(); } }
public static void main(String[] args) { RxNetty.createHttpServer(8888, new RequestHandler<ByteBuf, ByteBuf>() { @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { throw new NullPointerException("doomsday"); } }).startAndWait(); } }
public void start() { httpServer = RxNetty.createHttpServer(VIEW_PORT, new RequestHandler<ByteBuf, ByteBuf>() { @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { DeploymentReport report = createReport(); String result; try { result = MAPPER.writeValueAsString(report); } catch (IOException e) { return Observable.error(e); } return response.writeStringAndFlush(result); } }).start(); }
public void start() { httpServer = RxNetty.createHttpServer(VIEW_PORT, new RequestHandler<ByteBuf, ByteBuf>() { @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { DeploymentReport report = createReport(); String result; try { result = MAPPER.writeValueAsString(report); } catch (IOException e) { return Observable.error(e); } return response.writeStringAndFlush(result); } }).start(); }
public Eureka1Server() { this.server = RxNetty.createHttpServer(0, new RequestHandler<ByteBuf, ByteBuf>() { @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { logger.info("Eureka request {} {}", request.getHttpMethod(), request.getPath()); String path = request.getPath(); Matcher matcher = APPLICATIONS_PATH.matcher(path); if (matcher.matches()) { return applicationsResource(request, response); } matcher = REGISTRATION_PATH.matcher(path); if (matcher.matches()) { return registrationResource(request, response, matcher.group(1)); } matcher = INSTANCE_PATH.matcher(path); if (matcher.matches()) { return instanceResource(request, response, matcher.group(1), matcher.group(2)); } return notSupportedError(request, response); } }); applications.setAppsHashCode("0"); }
public static HttpServer<ByteBuf, ByteBuf> createHttpServer(int port, Application application, boolean start) { HttpServer<ByteBuf, ByteBuf> httpServer = RxNetty.createHttpServer(port, new RxNettyHttpContainer(application)); if (start) { httpServer.start(); } return httpServer; } }
@Override public HttpServer<ByteBuf, ByteBuf> get() { try { return RxNetty.createHttpServer(config.getServerPort(), new HttpRoutingRequestHandler(binding.getProvider().get())); } catch (Exception e) { throw new ProvisionException("Error creating server " + qualifier.getCanonicalName(), e); } } });
@PostConstruct public void start() { server = RxNetty.createHttpServer(config.getDashboardPort(), RequestHandlerWithErrorMapper.from( new MainRequestHandler(config), new FileErrorResponseMapper())).start(); logger.info("Starting HTTP dashboard server on port {}...", server.getServerPort()); }
@PostConstruct public void start() { server = RxNetty.createHttpServer(config.getDashboardPort(), RequestHandlerWithErrorMapper.from( new MainRequestHandler(config), new FileErrorResponseMapper())).start(); logger.info("Starting HTTP dashboard server on port {}...", server.getServerPort()); }
@Bean public HttpServer<ByteBuf, ServerSentEvent> aggregatorServer() { // multicast so multiple concurrent subscribers get the same stream Observable<Map<String, Object>> publishedStreams = StreamAggregator.aggregateGroupedStreams(hystrixSubject() .groupBy(data -> InstanceKey.create((String) data.get("instanceId")))) .doOnUnsubscribe(() -> log.info("BusTurbine => Unsubscribing aggregation.")) .doOnSubscribe(() -> log.info("BusTurbine => Starting aggregation")) .flatMap(o -> o).publish().refCount(); int port = new Integer(env.getProperty("server.port", "8989")); HttpServer<ByteBuf, ServerSentEvent> httpServer = RxNetty.createHttpServer(port, (request, response) -> { log.info("BusTurbine => SSE Request Received"); response.getHeaders().setHeader("Content-Type", "text/event-stream"); return publishedStreams .doOnUnsubscribe(() -> log.info("BusTurbine => Unsubscribing RxNetty server connection")) .flatMap(data -> response.writeAndFlush(new ServerSentEvent(null, null, JsonUtility.mapToJson(data)))); }, sseServerConfigurator()); return httpServer; }
public static void startServerSentEventServer(int port, Observable<GroupedObservable<TypeAndNameKey, Map<String, Object>>> streams) { logger.info("Turbine => Starting server on " + port); // multicast so multiple concurrent subscribers get the same stream Observable<Map<String, Object>> publishedStreams = streams .doOnUnsubscribe(() -> logger.info("Turbine => Unsubscribing aggregation.")) .doOnSubscribe(() -> logger.info("Turbine => Starting aggregation")) .flatMap(o -> o).publish().refCount(); RxNetty.createHttpServer(port, (request, response) -> { logger.info("Turbine => SSE Request Received"); response.getHeaders().setHeader("Content-Type", "text/event-stream"); return publishedStreams .doOnUnsubscribe(() -> logger.info("Turbine => Unsubscribing RxNetty server connection")) .flatMap(data -> { return response.writeAndFlush(new ServerSentEvent(null, null, JsonUtility.mapToJson(data))); }); }, PipelineConfigurators.<ByteBuf> sseServerConfigurator()).startAndWait(); }
this.subscribedLatch = new CountDownLatch(1); this.sem = new Semaphore(0); this.server = RxNetty.createHttpServer(0, (request, response) -> { response.getHeaders().setHeader("Accept", receiveCodec.mediaType());
this.subscribedLatch = new CountDownLatch(1); this.sem = new Semaphore(0); this.server = RxNetty.createHttpServer(0, (request, response) -> { response.getHeaders().setHeader("Accept", receiveCodec.mediaType());