複数のソースからマスター xml を構築する必要があるユース ケースがあります。最初にサービスから xml を取得し、この xml からの情報を使用して、さまざまなデータベース呼び出しを行って情報を保存/取得し、最後にマスター xml を構築してデータベースに保存します。Fuseでキャメルを使用しています。
Here is our xml and camel routes.
<xml>
<xmlInformation>
.....
</xmlInformation>
<customers>
<customer>...</customer>
<customer>...</customer>
<customer>...</customer>
</customers>
<products>
<product>....<product>
<product>....<product>
<product>....<product>
</products>
</xml>
顧客および製品要素の数は動的であり、xml から各顧客、製品を抽出し、データベースに保存して、いくつかの顧客、製品関連 ID を取得し、以下のようにマスター xml を構築します。
<m:master>
<m:xmlInformation>....</m:xmlInformation>
<c:customers>
<c:customer id="12345">....</c:customer>
<c:customer id="22345">....</c:customer>
<c:customer id="32345">....</c:customer>
</c:customers>
<p:products>
<p:product id="22222">.....</p:product>
<p:product id="11111">.....</p:product>
<p:product id="33333">.....</p:product>
</p:products>
</m:master>
Here is came route
<route id="routeA">
<from uri="direct-vm:saveMasterXml" />
<setProperty propertyName="originalIUPayload"><simple>${body}</simple></setProperty>
<splitter parallelProcessing=true stopOnException=true strategyRef="customersAggregator" >
<xpath>/xml/customers/customer</xpath>
<bean ref="customerService" method="saveCustomer" />
</splitter>
<setProperty propertyName="customerXmls"><simple>${body}</simple></setProperty>
<setBody><simple>${property.originalIUPayload}</simple></setBody>
<splitter parallelProcessing=true stopOnException=true strategyRef="productsAggregator" >
<xpath>/xml/products/product</xpath>
<bean ref="productService" method="getProductIds" />
</splitter>
<setProperty propertyName="productIds"><simple>${body}</simple></setProperty>
<setBody><simple>${property.originalIUPayload}</simple></setBody>
<!-- transformation -->
<bean ref="masterService" method="saveMasterXml" />
</route>
顧客のスプリッターの出力は、ID で強化された顧客 xml のリストであり、製品スプリッターの出力は製品 ID のリストです。マスターxmlの要素のほとんどは元のxmlですが、顧客からのIDと製品リストをxsltに渡す必要があるため、xsltを使用してマスターxmlを構築できますか? 私はそれを解決するためにここで立ち往生しています。どんな提案でも大歓迎です。