2017-03-09 51 views
0

我尝试使用Spring集成,并且在文档中找不到关于链线程的一些信息。我有XML:Spring集成链线程

<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

是的,在链中的每个组分将在相同的线程中运行。

是的,你可以使用ThreadLocal s到组件之间传送数据,但往往消息头被用于此目的,而不是。

+0

感谢您的回复。我需要在Client Interceptor中获取信息。它似乎在那里我无法获得集成邮件标题 - 只有肥皂信封。这是真的吗? – alexsodev

+0

这是正确的。 –