[英]How to send requests parallel to asynchronous services and collect the responses in a Java EE application?
I develop an application that at some point starts to aggregate an infomation from a bunch of services. 我开发了一个应用程序,该应用程序有时会开始聚合来自一堆服务的信息。 Some of that services are called via SOAP interfaces synchronously and some of them works asynchronosly - I have to send a request to JMS queue Q1 and get an answer to Q2 at some point. 其中一些服务是通过SOAP接口同步调用的,而某些服务则是异步运行的-我必须向JMS队列Q1发送请求,并在某个时候获得对Q2的答复。
The problem is that the app sends requests in one thread and the responses a processed using MDBs (Message-Driven Bean). 问题在于该应用程序在一个线程中发送请求,并使用MDB(消息驱动的Bean)对响应进行处理。 The solution from the top of my head is to store already aggregated responses in some shared container (like ConcurrentHashMap) with some correlationId. 从头开始的解决方案是将已聚合的响应存储在带有某些correlationId的某个共享容器中(例如ConcurrentHashMap)。 So when an MDB gets a response it looks through the shared container and adds response to the corresponding record. 因此,当MDB获得响应时,它会查看共享容器,并将响应添加到相应的记录中。
The app runs on WildFly AS in domain HA mode. 该应用程序在域HA模式下在WildFly AS上运行。
Let me answer your questions: 让我回答您的问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.