我目前正在基于 Vert.x(Kotlin) 构建项目,我需要连接到 MySQL 服务器。Vert.x 提供了这个作为 MySQL 连接的解决方案 - https://vertx.io/docs/vertx-mysql-client/kotlin
我注意到有两种方法可以实现这一点。
// Connect options
var connectOptions = MySQLConnectOptions(
port = 3306,
host = "the-host",
database = "the-db",
user = "user",
password = "secret")
// Pool options
var poolOptions = PoolOptions(
maxSize = 5)
// Create the pooled client
var client = MySQLPool.pool(connectOptions, poolOptions)
和
// Connect options
var connectOptions = MySQLConnectOptions(
port = 3306,
host = "the-host",
database = "the-db",
user = "user",
password = "secret")
// Pool options
var poolOptions = PoolOptions(
maxSize = 5)
// Create the pooled client
var client = MySQLPool.pool(vertx, connectOptions, poolOptions)
Vert.x 没有提到在什么样的情况下我们应该通过 vertx,有人知道吗?我们什么时候应该使用第二种实现方式?