낙타와 동면을 사용하여 mySQL 데이터베이스에 json 데이터를 삽입하려고합니다. 모든 것이 효과적입니다. 낙타 경로 루프가 작동하지 않습니다.
for (Module module : modules) {
from("timer://foo?delay=10000")
.loop(7)//not working
.to(module.getUrl() + "/api/json")
.convertBodyTo(String.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
int index = (Integer)exchange.getProperty("CamelLoopIndex"); // not working
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(exchange.getIn().getBody().toString());
String[] lijst = {"lastBuild", "lastCompletedBuild", "lastFailedBuild", "lastStableBuild", "lastSuccessfulBuild", "lastUnstableBuild", "lastUnsuccessfulBuild"};
JSONObject obj = new JSONObject();
JsonNode node = root.get(lijst[index]);
JsonNode build = node.get("number");
obj.put("description", lijst[index]);
obj.put("buildNumber", build);
exchange.getIn().setBody(obj.toString());
}
})
.unmarshal(moduleDetail)
.to("hibernate:be.kdg.teamf.model.ModuleDetail")
.end();
}
내가 디버깅
, 내 CamelLoopIndex은 0이되므로은 (는) 루프를 통과 할 때마다 증가하지 않습니다 남아있다.모든 도움을 환영합니다!
루프는 끝 '까지 간다()'. 그래서 나는 네가 틀렸다고 생각한다. –
본인과 동일한 문제가 발생했습니다. 루프 스코프가 첫 번째 to() 명령어를 닫는 것처럼 보이고 end() 명령어가 의미가없는 것처럼 보입니다. 나는 문서에서 그걸 발견하지 못했습니다. –