vert.x

How to dispatch incoming NetSocket handlers into different event loop threads?

雨燕双飞 提交于 2019-12-08 10:40:14
问题 I'm trying to use Vertx to implement a TCP server, accepting incoming connections and then handling different sockets. Since each socket can be handled independently, the handlers belonging to different sockets are supposed to run in different event loop threads concurrently. According to Vert.x document, Standard verticles are assigned an event loop thread when they are created and the start method is called with that event loop. When you call any other methods that takes a handler on a core

Sequential composition for arbitrary number of calls in Vertx with Futures

妖精的绣舞 提交于 2019-12-08 01:35:03
问题 We use Futures in vertx in examples like: Future<JsonObject> fetchVehicle = getUserBookedVehicle(routingContext, client); fetchVehicle.compose(vehicleJson -> vehicleDoor(routingContext, client, vehicleJson, lock)).setHandler( asyncResult -> { if (asyncResult.succeeded()) { LOG.info("Door operation succeeded with result {}", asyncResult.result().encode()); handler.handle(Future.succeededFuture(new AsyncReply(200, "OK"))); } else { handler.handle(Future.failedFuture(asyncResult.cause())); } });

Deploy Vert.x on Tomcat

柔情痞子 提交于 2019-12-07 22:06:56
问题 I need to deploy to a PaaS (HANA Cloud Platform) that only supports a Tomcat container and also want to run Vert.x as an async framework. What I did so far is to bootstrap Vert.x through a servlet: public class VertxServlet extends HttpServlet { ... @Override public void init(ServletConfig cfg) { Vertx vertx = Vertx.vertx(); vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() { public void handle(HttpServerRequest req) { System.out.println("Got request: " + req.uri());

Can I set a capacity on the Vert.x HTTP request queue?

人盡茶涼 提交于 2019-12-07 15:06:31
问题 I have written a Vert.x HTTP server in Java. When the client sends requests faster than the server can process them, the server-side request queue slowly fills up. Eventually the JVM runs out of memory because of all the accumulating requests. Can I set a capacity on the Vert.x request queue? I would like to set one or more of the following: A maximum number of queued requests A maximum size (in bytes) of all queued requests When either of these limits is violated by an incoming request, I

accepting list of parameters of same key in vertx api

泄露秘密 提交于 2019-12-06 14:25:02
How to accept list of parameter in same key in router GET method. e.g I have a query parameter name as 'personId'. but in get request there can be multiple(list of) personId are coming. How to handle this in vertx. I couldnt find any such method in HttpServerRequest Class. I have another option to accept single parameter but with comma separated ids. But isn't it wrong? Isn't there any other way? I think the URI should like localhost:8081/myApi?personId=1&personId=2&personId=3 FInally found it. HttpServerRequest request = RoutingContext.request(); MultiMap params = request.params(); List

Sequential composition for arbitrary number of calls in Vertx with Futures

亡梦爱人 提交于 2019-12-06 11:52:01
We use Futures in vertx in examples like: Future<JsonObject> fetchVehicle = getUserBookedVehicle(routingContext, client); fetchVehicle.compose(vehicleJson -> vehicleDoor(routingContext, client, vehicleJson, lock)).setHandler( asyncResult -> { if (asyncResult.succeeded()) { LOG.info("Door operation succeeded with result {}", asyncResult.result().encode()); handler.handle(Future.succeededFuture(new AsyncReply(200, "OK"))); } else { handler.handle(Future.failedFuture(asyncResult.cause())); } }); where we handle 2 calls for example. OR I have another snippet where I can handle any number of

区块链课堂|读懂公链学开发:深入浅出剖析比原链技术特性(线上免费)

情到浓时终转凉″ 提交于 2019-12-06 05:50:57
9月2日,HiBlock区块链社区和比原链到深圳做了一场线下沙龙活动,活动结束后有一位参会者跑过来问我,怎样才能快速掌握区块链开发? 我想起不久前有一位社区的老师说过这么一句话:从公链开发开始,在没有造轮子的能力前,就先用开源框架。 区块链公链为开发者提供了底层技术架构和相应的开发工具,比如以太坊的智能合约,基于以太坊可以很轻松的写出Token的代码或者其他的很多应用,基于公链学习区块链开发,是初级开发者快速掌握开发能力的途径。 本次区块链课堂我们邀请 比原链技术运营经理钟立飞老师为社区用户带来一次线上分享课程,通过深入浅出剖析比原链的技术特性,讲解设计理念、架构、butxo、智能合约等相关特性,从公链入手,学习区块链开发。 1 课程大纲及分享嘉宾 话题:深入浅出的剖析比原链技术特性 话题大纲: bytom 是什么 bytom 设计理念 bytom 架构 butxo 智能合约 分享嘉宾:钟立飞 比原链技术运营经理,Vert.x中国开源社区发起者,巴比特专栏作家 2 如何报名 **课程时间:**2018年9月8日(周六)20:00-21:30 一小时分享,半小时讨论答疑 本课程为 线上课程,免费 报名方式:扫描下图中二维码,添加小助手,验证输入“006”,即可报名并加入课程群。 来源: oschina 链接: https://my.oschina.net/u/3782027/blog

Can I set a capacity on the Vert.x HTTP request queue?

十年热恋 提交于 2019-12-06 03:05:26
I have written a Vert.x HTTP server in Java. When the client sends requests faster than the server can process them, the server-side request queue slowly fills up. Eventually the JVM runs out of memory because of all the accumulating requests. Can I set a capacity on the Vert.x request queue? I would like to set one or more of the following: A maximum number of queued requests A maximum size (in bytes) of all queued requests When either of these limits is violated by an incoming request, I would like to immediately respond with 503 Service Unavailable . AFAIK there's no built-in way to