Web サービス要求を jms キューの InOnly エンドポイントにルーティングしたいと考えています。次に、別の InOnly エンドポイントから受信した応答 jms メッセージを、応答として Web サービス クライアントにルーティングします。Web サービスの要求/応答は同期 InOut パターンで、サブルートは非同期です。Camelでこれを達成するには、どのようなオプションが必要ですか?
ここの Camel ルートは、私の質問を説明するために使用されます。
String uri={webserice uri}
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
ServcieRequest req =
exchange.getIn().getBody(ServcieRequest.class);
// One option to me is to spawn another route here to route to jms queue...
ProducerTemplate template = exchange.getContext().createProducerTemplate();
template.sendBodyAndHeaders("jms:queue:INQueue", req.getPayload(), headers);
// then need to wait ...until received jms response from the route below
}});
from("jms:queue:OUTQueue")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
// received jms response message
// need to update the exchange data in the above route based on jms message
// so the final response to the webservice cilent can receive the data ...
}});