1

骆驼保险丝 2.8

我有一个骆驼 jaxrs 服务器,它接受请求然后启动 2 条骆驼路线。

第一个路由,使用来自 cxfrs 端点/bean 的请求并将它们发送到 jms queue inbox

第二条路线,使用来自 jms queue inbox的请求进行业务逻辑处理,然后将结果发送到 jms queue outbox

我的问题与 http 响应和将结果发送给 jaxrs 服务器消费者有关。

是否可以从第一条路由将 http 响应发送回 http 客户端,并从第二条路由返回结果?(同步)

        from("cxfrs:bean:personLookupEndpoint")   <-- http client waits for response...
            .setExchangePattern(ExchangePattern.InOut)
            .process(new RequestProcessor())
            .to(inbox);


        from(inbox)
            .unmarshal(jaxb)
            .process(new QueryServiceProcessor())
            .to("bean:lookupService?method=processQuery(${body})")
            .convertBodyTo(String.class)
            .to(outbox);  <-- need to send results to font-end consumer synchronously ...
4

1 回答 1

1

你真的需要使用队列吗?我认为使用 direct: 路由会更好。

可以将 InOut 交换模式用于 JMS 端点,但它有一些限制: http: //fusesource.com/docs/router/2.2/transactions/JMS-Synchronous.html

于 2013-02-05T05:15:28.720 回答