Has io.vertx:vertx-mysql-client:3.9.4 similiar purpose as R2DBC?

558 views
Skip to first unread message

Jim C

unread,
Nov 16, 2020, 1:48:37 PM11/16/20
to vert.x
My straigh question is: can I rely on vertx-mysql-client as a database reactive driver? I have used Spring-data-Reactive based on R2DBC and I believe I have done a good decision so far but this time Spring-Data isn't an option.

It is my first contact with VERTX. I am looking for some reasonable way to code a reactive database client. I have coded few applications using Spring-Data and it was very straighforward. Now our directive is a stack that is based on Micronaut and we want to avoid Spring (nothing against Spring but it was decided to avoid reflection and take advantage of Micronaut AOT feature).

I am far away to be an expert in reactive paradgmas but I am convinced that, when designing a reactive solution, it must be reactive from begin to end. I mean, we must avoid mixing blocking code (ex. jdbc) with reactive (ex. Webflux) otherwise we lost the pros of the effort to code a reactive solution. 

So, I am developing a a Kafka Consumer based on Micronaut and it is aimed to save reactivelly to a database (the database itself doesn't matter for this question. I believe NOSQLs are better than RELATIONALs for a reactive stack but let me leave this for other discussion). It is fine for my question be answer with either MySql or PostGres in mind.

Julien Ponge

unread,
Nov 16, 2020, 2:52:18 PM11/16/20
to ve...@googlegroups.com
The Vert.x reactive database drivers are great. Just have a look at TechEmpower Benchmarks. 

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/53478ac9-8d81-4c38-a3ab-ceca920c0507n%40googlegroups.com.

Jim C

unread,
Nov 16, 2020, 3:47:43 PM11/16/20
to vert.x
@Julien, thanks. Probably a very silly question: is vertx-mysql-client based on R2DBC?
PS.: I am looking for a tutorial/example how work with https://vertx.io/docs/apidocs/io/vertx/reactivex/ext/mongo/MongoClient.html. By tutorial/examples I mean some good explanation like https://vertx.io/docs/vertx-mongo-client/java/ and https://vertx.io/blog/combine-vert-x-and-mongo-to-build-a-giant/ but as far as I can see, both are focues on blocking code instead of reactive.
If you know kindly let me know it

Julien Ponge

unread,
Nov 16, 2020, 4:14:49 PM11/16/20
to ve...@googlegroups.com
The Vert.x reactive clients are not based on R2DBC. They are clean-room implementations of the database network wire protocols.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/a24f1da2-3565-4c2f-8d28-e8494b451d60n%40googlegroups.com.

Jim C

unread,
Nov 16, 2020, 5:39:13 PM11/16/20
to vert.x
This sounds much better. Thanks. I understand you have answer perfectly my question. If you can run your eyes in another issue, I am strugling to setup my first connection from microanut to MySql throw vertx and I have just posted in https://stackoverflow.com/questions/64866719/connecting-to-mysql-causing-connection-refused-no-further-information (not sure if it is an issue with vertx or micronaut)

Julien Viet

unread,
Nov 18, 2020, 5:52:19 AM11/18/20
to vert.x
Hi,

it seems that your application is blocked when trying to write on the standard output.

do you have a reproducer project you can share with us?

Julien

Jim C

unread,
Nov 18, 2020, 7:22:51 AM11/18/20
to vert.x
Julien Ponge, thanks for trying help me.
 Yes, the whole code is in https://github.com/jimisdrpc/demo-vertx-mysql

The gradle bellow is properly setup, isn't it?

In order to use vertx with mysql I have just added two lines to gradle

1 - implementation("io.micronaut.sql:micronaut-vertx-mysql-client")
2 - compile 'io.vertx:vertx-lang-kotlin:3.9.4'  

build.gradle

plugins {
id "org.jetbrains.kotlin.jvm" version "1.4.10"
id "org.jetbrains.kotlin.kapt" version "1.4.10"
id "org.jetbrains.kotlin.plugin.allopen" version "1.4.10"
id "com.github.johnrengelman.shadow" version "6.1.0"
id "io.micronaut.application" version '1.0.5'
}

version "0.1"
group "com.mybank"

repositories {
mavenCentral()
jcenter()
}

micronaut {
testRuntime "junit5"
processing {
incremental true
annotations "com.mybank.*"
}
}

dependencies {
implementation("io.micronaut:micronaut-validation")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
implementation("io.micronaut:micronaut-runtime")
implementation("javax.annotation:javax.annotation-api")

implementation("io.micronaut.sql:micronaut-vertx-mysql-client")
//implementation("io.micronaut.configuration:micronaut-vertx-mysql-client")
compile 'io.vertx:vertx-lang-kotlin:3.9.4'

implementation("io.micronaut.kafka:micronaut-kafka")
runtimeOnly("ch.qos.logback:logback-classic")
runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
testImplementation("io.micronaut:micronaut-http-client")
}

mainClassName = "com.mybank.ApplicationKt"
java {
sourceCompatibility = JavaVersion.toVersion('11')
}

compileKotlin {
kotlinOptions {
jvmTarget = '11'
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '11'
}
}

Reply all
Reply to author
Forward
0 new messages