vert.x

Java common JDBC SQL Query strategy for Unit Test using HSQLDB and runtime using MySQL

自闭症网瘾萝莉.ら 提交于 2020-07-23 06:49:06
问题 I am developing Java Vert.x 3 application. I use HSQLDB for testing with in-memory DB and MySQL 8.0.20 for runtime. When the vertx verticle is deployed, it initializes the db and tables. Since this is a common code and there are differing SQL syntax between HSQLDB and MySQL and more ridiculously, the HSQLDB capitalizes all the property names and I have to double-quote the properties to use lower-case. I wonder how to achieve this. Here are my questions: (1) HSQLDB uses "IDENTITY" keyword for

How to perform SELECT query of PL/pgSQL user-defined function in jOOQ which returns JSON type?

人走茶凉 提交于 2020-07-10 10:27:06
问题 I'm having issue with finding right way to cast my user-defined function in PL/pgSQL into jOOQ code. My user-defined function in PL/pgSQL returns JSON type and I need to somehow adjust/cast it in jOOQ. I've Googled examples, but found none. Just in case here is my user-defined function in PL/pgSQL: create or replace function public.get_order_by_order_id(o_id bigint) returns json as $BODY$ DECLARE total_oi_price double precision; book_price double precision; total_price double precision; oi

What are diffrences between wrk2 and Apache Benchmark (i.e. ab) tools?

别说谁变了你拦得住时间么 提交于 2020-07-09 11:51:08
问题 Are there any significant difference between wrk2 and Apache's Benchmark (i.e. ab ) for testing multi-threaded requests? If there are what are they? I'm asking this based on this answer and as I have to test Java RESTful Service Web CRUD app written in SpringBoot (uses Apache Tomcat web server), Dropwizard (uses Jersey web server) and Vert.X (web server is part of it's own implementation as much as I know, please correct me if I'm wrong ) using concurrent HTTP requests . Any advice/help is

can vert.x event bus replace the need for Kafka?

巧了我就是萌 提交于 2020-07-05 07:30:11
问题 I am evaluating the vert.x framework to see if I can reduce the Kafka based communications between my microservices developed using spring boot. The question is: Can I replace 1. Kafka with vert.x event bus and 2. spring boot microservices with vert.x based verticles Any pointers will be of great help. Thanks in advance. 回答1: To answer quickly, I would say it depends on your needs. Yes, the eventbus can be a good way to handle natively communication between microservices verticles using an

How to avoid Google guice injector getInstance() repetative calls due to null?

♀尐吖头ヾ 提交于 2020-06-01 05:14:29
问题 I have recently started using Google guice DI framework and am quite new to it. I am facing below problem - @inject returns null always and have to call injector to inject various references. This is my AbstractModule class public class AppModule extends AbstractModule { private static final Injector injector = Guice.createInjector(new AppModule()); private final Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions( new DropwizardMetricsOptions().setEnabled(true) )); private final

How to avoid Google guice injector getInstance() repetative calls due to null?

那年仲夏 提交于 2020-06-01 05:14:26
问题 I have recently started using Google guice DI framework and am quite new to it. I am facing below problem - @inject returns null always and have to call injector to inject various references. This is my AbstractModule class public class AppModule extends AbstractModule { private static final Injector injector = Guice.createInjector(new AppModule()); private final Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions( new DropwizardMetricsOptions().setEnabled(true) )); private final

Vertx HttpClient getNow not working

我怕爱的太早我们不能终老 提交于 2020-05-13 14:47:09
问题 I have problem with vertx HttpClient. Here's code which shows that tests GET using vertx and plain java. Vertx vertx = Vertx.vertx(); HttpClientOptions options = new HttpClientOptions() .setTrustAll(true) .setSsl(false) .setDefaultPort(80) .setProtocolVersion(HttpVersion.HTTP_1_1) .setLogActivity(true); HttpClient client = vertx.createHttpClient(options); client.getNow("google.com", "/", response -> { System.out.println("Received response with status code " + response.statusCode()); });

使用vertx共享数据

▼魔方 西西 提交于 2020-05-02 09:52:09
Using Shared Data with Vert.x io.vertx.core.shareddata 接口计数器 公共接口 柜台 一个异步计数器,可用于跨集群维护一致的计数。 作者: 蒂姆·福克斯 方法总结 所有方法 实例方法 抽象方法 修饰符和类型 方法和说明 void addAndGet (long value, Handler < AsyncResult < Long >> resultHandler) 将值自动添加到计数器,然后返回新的计数 void compareAndSet (long expected, long value, Handler < AsyncResult < Boolean >> resultHandler) 仅当当前值为期望值时,才将计数器设置为指定值。 void decrementAndGet ( Handler < AsyncResult < Long >> resultHandler) 自动减少计数器并返回新计数 void get ( Handler < AsyncResult < Long >> resultHandler) 获取计数器的当前值 void getAndAdd (long value, Handler < AsyncResult < Long >> resultHandler) 将值原子地添加到计数器

[转帖]惊呆了,Spring Boot居然这么耗内存!

混江龙づ霸主 提交于 2020-04-17 08:26:43
【推荐阅读】微服务还能火多久?>>> 惊呆了,Spring Boot居然这么耗内存! https: // blog.csdn.net/weixin_44337261/article/details/100681541 Spring Boot总体来说,搭建还是比较容易的,特别是Spring Cloud全家桶,简称亲民微服务,但在发展趋势中,容器化技术已经成熟,面对巨耗内存的Spring Boot,小公司表示用不起。如今,很多刚诞生的JAVA微服务框架大多主打“轻量级”,主要还是因为Spring Boot太重。 JAVA系微服务框架 No1-Spring Cloud 介绍 有Spring大靠山在,更新、稳定性、成熟度的问题根本不需要考虑。在JAVA系混的技术人员大约都听说过Spring的大名吧,所以不缺程序员……,而且这入手的难度十分低,完全可以省去一个架构师。 但是,你必然在服务器上付出: 至少一台“服务发现 ”的服务器; 可能有一个统一的网关Gateway; 可能需要一个用于“分布式配置管理”的配置中心; 可能进行“服务追踪”,知道我的请求从哪里来,到哪里去; 可能需要“集群监控”; 项目上线后发现,我们需要好多服务器,每次在集群中增加服务器时,都感觉心疼; 压测30秒 压测前的内存占用 如图,内存占用304M。 压测时的内存占用 如图,内存占用1520M(1.5G)

更改Web根目录

微笑、不失礼 提交于 2020-04-16 16:48:38
【推荐阅读】微服务还能火多久?>>> 配置缓存 默认情况下,静态处理程序将设置缓存标头以使浏览器能够有效地缓存文件。 Vert.x的Web设置标题 cache-control , last-modified 和 date 。 cache-control max-age=86400 默认设置为。这相当于一天。 setMaxAgeSeconds 如果需要,可以配置它 。 如果浏览器发送带有 if-modified-since 标头的GET或HEAD请求,并且该资源自该日期起未被修改, 304 则返回状态,告知浏览器使用其本地缓存的资源。 如果不需要处理缓存头,则可以禁用它 setCachingEnabled 。 启用缓存处理后,Vert.x-Web将缓存内存中资源的最后修改日期,这样可以避免磁盘命中每次都检查实际的上次修改日期。 缓存中的条目具有到期时间,在此之后,将再次检查磁盘上的文件并更新缓存条目。 如果您知道您的文件永远不会在磁盘上更改,那么缓存条目将永远不会过期。这是默认值。 如果您知道在服务器运行时您的文件可能在磁盘上发生更改,那么您可以将只读文件设置为false setFilesReadOnly 。 要在任何时候启用可以在内存中缓存的最大条目数,您可以使用 setMaxCacheSize 。 要配置可以使用的缓存条目的到期时间 setCacheEntryTimeout 。