I have vertx server application where I am getting single client requests and from the server, I need to make two blocking calls. For instance, one call to back-end system A and another call to back-end system B. I am looking to make two concurrent calls to both the systems. I need to wait for the responses from both the calls and then merge two data from both the calls and then send the response back to client. I am unable to figure out how to do this in worker verticle.
我有vertx服务器应用程序,我收到单个客户端请求,从服务器,我需要进行两次阻止调用。例如,一次调用后端系统A,另一次调用后端系统B.我希望对这两个系统进行两次并发调用。我需要等待来自两个调用的响应,然后合并来自两个调用的两个数据,然后将响应发送回客户端。我无法弄清楚如何在worker verticle中执行此操作。
Could anyone recommend what would be the best approach in vertx?
任何人都可以推荐什么是vertx中最好的方法?
1 个解决方案
#1
This sounds like a good use case for Promises. Give the module vertx-promises a try.
这听起来像是Promises的一个很好的用例。试试模块vertx-promises。
#1
This sounds like a good use case for Promises. Give the module vertx-promises a try.
这听起来像是Promises的一个很好的用例。试试模块vertx-promises。