2017-03-09 19 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

這是正確的。 –