0

我有如下路线

from(direct:start)
.process(new Processor() {
                    @Override
                public void process(Exchange exchange) throws Exception {
                   exchange.setProperty("doc_url", "http://myhost:5984/test/record/doc.csv"); 
                }
}).setHeader(Exchange.HTTP_METHOD, constant("GET"))
.convertBodyTo(String.class)
.recipientList(header("doc_url")
.split().streaming.process(new MyProcessor());

我不想每次都运行 apache couchdb 进行测试。我想让这个 http 端点引用代码库中的资源文件。这个怎么写?

4

1 回答 1

2

您可以使用Camel AdviceWith功能来拦截/替换端点以进行测试...

 camelContext.getRouteDefinition("myRouteId")
  .adviceWith(camelContext, new AdviceWithRouteBuilder() {
    @Override
    public void configure() throws Exception
    {
        interceptSendToEndpoint("couchdb:http://localhost/database)
        .skipSendToOriginalEndpoint()
        .to("http://localhost:5984/test/record/doc.csv");
    }
});
于 2014-06-23T20:46:55.457 回答