[英]Channels for request-reply pattern using http-outbound-gateway
I need to send request and receive response synchronously (in the same thread) using http-outbound-gateway in multi-threaded environment (multiple threads doing the same). 我需要在多线程环境(多个线程执行相同操作)中使用http-outbound-gateway同步发送请求和接收响应(在同一线程中)。
I am thinking to use DirectChannel as request and response channels in http-outbound-gateway. 我正在考虑将DirectChannel用作http-outbound-gateway中的请求和响应通道。 If I do that, will the following scenario occurs:
如果我这样做,会发生以下情况:
Note: The request/response channels are same for both the threads. 注意:两个线程的请求/响应通道相同。
If this occurs how to resolve this problem. 如果发生这种情况,如何解决此问题。 My requirement is, always the thread that generated the request should process the corresponding response.
我的要求是,生成请求的线程始终应处理相应的响应。
No; 没有; it's completely thread safe;
它是完全线程安全的; thread1 will get its response;
thread1将得到其响应; thread2 will get its response;
thread2将得到其响应; there can be no cross-talk.
不能有串扰。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.