簡體   English   中英

Spring Integration鏈線程

[英]Spring Integration chain threads

我嘗試使用Spring Integration,但在文檔中找不到有關鏈線程的某些信息。 我有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在一個鏈端點中保存一些信息,並在該鏈的下一個端點中使用該信息嗎?

是的,鏈中的每個組件都將在同一線程上運行。

是的,您可以使用ThreadLocal在組件之間傳遞數據,但是通常將消息頭用於此目的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM