我尝试使用Spring Integration,但没有在doc中找到有关链线程的一些信息。我有xml:
<task:executor
id="worker"
pool-size="5"
queue-capacity="5"
rejection-policy="CALLER_RUNS"/>
<int:channel id="inputChannel" datatype="javax.xml.bind.JAXBElement">
<int:dispatcher task-executor="worker"/>
</int:channel>
<int:chain input-channel="inputChannel" id="someChain">
<int-ws:header-enricher>
<int-ws:soap-action value="${someValue}"/>
</int-ws:header-enricher>
<int:header-enricher>
<int:header name="url" value="${someUri}"/>
</int:header-enricher>
<int-ws:outbound-gateway uri="${someUri}"
ignore-empty-responses="true"
requires-reply="true"
marshaller="someMarshaller"
interceptors="someMessageInterceptors">
<int-ws:request-handler-advice-chain>
<ref bean="integrationInterceptor" />
</int-ws:request-handler-advice-chain>
</int-ws:outbound-gateway>
</int:chain>
我的问题是:该链中的所有端点是否都会起作用,但所有端点都在不同的线程中?网关响应和请求是否会在单独的线程中工作?我可以使用ThreadLocal在一个链端点中保存一些信息,并在该链的下一个端点中使用该信息吗?
答案 0 :(得分:0)
是的,链中的每个组件都将在同一个线程上运行。
是的,您可以使用ThreadLocal
来在组件之间传送数据,但通常会将消息标头用于此目的。