How to send asynchronous requests/responses through collaborating Channel Adapters without correlating data

試著忘記壹切 提交于 2019-12-02 07:32:57

It's difficult to correlate request/replies without the data containing correlation information.

The TcpOutboundGateway can do it because the socket itself is used for the correlation; only one request can be outstanding on each socket at a time. The CachingClientConnectionFactory allows concurrency in the gateway by maintaining a pool of sockets.

One technique might be a custom client connection factory that maintains a one-to-one map between your server factory connections and outgoing connections. Then, when a reply is received, look up the corresponding server factory connection to which to send the reply. It would just need a couple of maps - server connection id to client connection, and client connection id to server connection id.

If you come up with a solution, consider contributing it back to the framework.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!