使用camel中的资源流模拟Camel http端点

时间:2014-06-21 19:41:12

标签: apache-camel camelcasing camel-ftp

我有一条如下路线

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端点引用代码库中的资源文件。怎么写这个?

1 个答案:

答案 0 :(得分:0)

您可以使用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");
    }
});