簡體   English   中英

Mule ESB-在同一流程中配置多個組件

[英]Mule ESB - Configure Multiple Components in same Flow

嘗試將Spring組件添加到Mule Flow時收到錯誤消息。 這應該是一個常見的用戶案例,但是我找不到正確的文檔或示例。 提前致謝。

以下是原始配置,效果很好:

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="server:port/JSONAPI/"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>

    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

我只是想添加一個新組件來進行一些后處理。 當我嘗試此操作時,它不起作用:

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="server:port/JSONAPI/"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>
    <component>
      <spring-object bean="postProcessor"/>
    <component>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

其中“ postProcessor”將配置中的其他位置映射為spring bean。

我收到的錯誤消息是:

org.xml.sax.SAXParseException:cvc-complex-type.2.4.a:發現無效的內容(從元素“ component”開始)。 '{“ http://www.mulesoft.org/schema/mule/core”:abstract-lifecycle-adapter-factory “,” http://www.mulesoft.org/schema/mule/core“:binding }之一' 是期待。

上面的錯誤清楚地表明標記<component>沒有關閉。

例如,應采用以下格式:-

 <component>
    <spring-object bean="postProcessor"/>
 </component>

您需要在代碼末尾添加如下代碼:- </component>

還有一件事...我嘗試運行您的代碼,但是由於在您的inbound-endpoint地址中配置了server:port/JSONAPI/ ,因此出現錯誤,表明xml格式錯誤

所以我修改了您的代碼,如下所示,它成功運行了:

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="http://localhost:8189/JSONAPI"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>
    <component>
      <spring-object bean="postProcessor"/>
    </component>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

因此,您現在可以使用它並根據需要進行修改

暫無
暫無

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

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