私は以下の経路といくつかの問題を抱えて:ApacheのキャメルEIPルート - スプリットを停止する方法()
// from("cxf:....")...
from("direct:start").process(startRequestProcessor) // STEP 1
.choice()
.when(body().isNull())
.to("direct:finish")
.otherwise()
.split(body()) // STEP 2
.bean(TypeMapper.class) // STEP 3
.log("Goes to DynamicRouter:: routeByTypeHeader with header: ${headers.type}")
.recipientList().method(Endpoint1DynamicRouter.class, "routeByTypeHeader") // STEP 4
.ignoreInvalidEndpoints();
from("direct:endpoint2") // STEP 6
.log("Goes to DynamicRouter::routeByCollectionHeader with header: ${headers.collection}")
.recipientList().method(Endpoint2DynamicRouter.class, "routeByCollectionHeader")
.ignoreInvalidEndpoints();
from("direct:endpoint1.1") // STEP 5
.process(new DateRangeProcessor())
.to("direct:collections");
from("direct:endpoint1.2") // STEP 5
.process(new SingleProcessor())
.to("direct:collections");
from("direct:endpoint2.2") // STEP 7
.aggregate(header("collection" /** endpoint2.2 */), CollectionAggregationStrategy)
.completionSize(exchangeProperty("endpoint22"))
.process(new QueryBuilderProcessor())
.bean(MyService, "getDbCriteria")
.setHeader("collection", constant("endpoint2.1"))
.to("direct:endpoint2.1").end();
from("direct:endpoint2.1") // STEP 8
.aggregate(header("collection" /** endpoint2.1 */), CollectionAggregationStrategy)
.completionSize(exchangeProperty("CamelSplitSize"))
.to("direct:finish").end();
from("direct:finish")
.process(new QueryBuilderProcessor())
.bean(MyRepository, "findAll")
.log("ResponseData: ${body}").
marshal().json(JsonLibrary.Gson).end();
- は、JSON文字列ANは(HashSetの)をリストに変換する受信経路のJSONObjects。
- 受信したリストをjsonオブジェクトに分割します。
- 基準をMongoDBのためのメッセージを変換するための別のヘッダに係る
- Endpoint2ルートメッセージをendpoint2に送信
- メッセージヘッダーに係るendpoint1.1へのルートまたはendpoint1.2を対象コンテンツに応じてヘッダを対応
- セットエンドポイント2.1またはエンドポイント2.2。
- Endpoint2.2はすべての受信メッセージを集約し、それを処理してmongodb Criteriaを取得し、endpoint2.1に送信します(completionSizeはステップ2で計算され、プロパティ "endpoint22"に保存されます)。
- Enpoint2.1集約すべてのメッセージ(CamelSplitSize)は集約されたメッセージをQueryオブジェクトに変換し、Repositoryに送信してデータを取得します。
私は、デバッガで有効な応答オブジェクトを見ることができますが、とにかく、私はエラーを取得する:
No message body writer has been found for class java.util.HashSet, ContentType: application/json
それが他のルートで動作し、それがHashSetsが含まれていないなどの問題がレスポンスオブジェクトではありません。 HashSetのは、TATのSTEP 1を作成した出力に送信する
私の推測では...
そのルートである私の質問は以下のとおりです。
- ルート出力で何が間違っていますか?
両方RECIPIENTLIST()無効なエンドポイント(私は例外を回避するために.ignoreInvalidEndpoints()を使用する必要がある)に メッセージを転送しよう:
org.apache.camel.NoSuchEndpointException: No endpoint could be found for: [email protected], please check your classpath contains the needed Camel component jar.
すべてのヘルプははるかに高く評価されるだろう! ありがとうございました。