【发布时间】:2017-11-22 08:05:58
【问题描述】:
我有以下路线:
from("quartz2:findAll//myGroup/myTimerName?cron=" + pushProperties.getQuartz())
//.setBody().constant("{ \"id\": \"FBJDBFJHSDBFJSBDfi\" }")
.to("mongodb:mongoBean?database=" + mongoDataConfiguration.getDatabase()
+ "&operation=findAll&collection=" + mongoDataConfiguration.getDataPointCollection())
.process(exchange -> {
exchange.getIn().setBody(objectMapper.writeValueAsString(exchange.getIn().getBody()));
}).streamCaching()
.setHeader(Exchange.HTTP_METHOD, constant(pushProperties.getHttpMethod()))
.setHeader(Exchange.CONTENT_TYPE, constant(MediaType.APPLICATION_JSON_VALUE))
.to(pushProperties.getUrl() + "&throwExceptionOnFailure=false").streamCaching()
如你所见,我使用throwExceptionOnFailure=false
然后我从配置中获取我的网址。但是我们发现如果
pushProperties.getUrl() = localhost:8080/url?action=myaction
并且在
的情况下不起作用pushProperties.getUrl() = localhost:8080/url
camel 中是否有通用方式向 URL 添加请求参数?
类似:
private String buildUrl() {
String url = pushProperties.getUrl();
return url + (url.contains("?") ? "&" : "?") + "throwExceptionOnFailure=false";
}
在 Camel api 中
【问题讨论】:
标签: java apache-camel dsl spring-camel