服务器故障转移与Quarkus响应式MySQL客户端 / io.vertx.mysqlclient

huangapple go评论89阅读模式
英文:

server failover with Quarkus Reactive MySQL Clients / io.vertx.mysqlclient

问题

io.vertx.mysqlclient是否支持服务器故障转移 就像MySQL Connector/J中可以设置的那样

我的应用程序基于使用io.vertx.mutiny.mysqlclient.MySQLPool的Quarkus,该池反过来又基于io.vertx.mysqlclient。如果在该堆栈中支持服务器故障转移,该如何设置?我在文档和代码中没有找到任何提示。

英文:

Does io.vertx.mysqlclient support server failover as it can be set up with MySQL Connector/J?

My application is based on quarkus using io.vertx.mutiny.mysqlclient.MySQLPool which in turn is based on io.vertx.mysqlclient. If there is support for server failover in that stack, how can it be set up? I did not find any hints in the documentation and code.

答案1

得分: 5

不,它不支持故障转移。

您可以创建两个客户端,然后使用Munity故障转移方法来达到相同的效果:

MySQLPool client1 = ...
MySQLPool client2 = ...

private Uni<List<Data>> query(MySQLPool client) {
  // 使用client参数将查询发送到数据库
}

Uni<List<Data>> results = query(client1)
    .onFailure().recoverWithUni(() -> query(client2));
英文:

No it doesn't support failover.

You could create two clients and then use Munity failover methods to get the same effect:

MySQLPool client1 = ...
MySQLPool client2 = ...

private Uni&lt;List&lt;Data&gt;&gt; query(MySQLPool client) {
  // Use client param to send queries to the database
}

Uni&lt;List&lt;Data&gt;&gt; results = query(client1)
    .onFailure().recoverWithUni(() -&gt; query(client2));

huangapple
  • 本文由 发表于 2020年10月1日 22:09:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/64157165.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定