1
한 응용 프로그램에 Apache camel 및 spring boot를 사용하고 있습니다. 디렉토리에서 읽은 다음 XML을 비동기로 읽은 다음 비 정렬 화 된 객체를 처리하여 더 많은 데이터를 설정 한 다음 다시 마샬링하고 다른 폴더로 보내야합니다. 다음 경로를 사용하고 있습니다. 프로세서로 언 마샬링 (unmarshalling) 한 후 POJO를 보내는 방법을 알려주십시오. 현재는 기본적으로 교환기가 프로세서로 들어갑니다. 프로세서를 사용하는 경우비 정렬 객체를 Camel 프로세서에 전달하십시오.
@SpringBootApplication
public class CamelApplication extends FatJarRouter {
public static void main(String ... args) {
SpringApplication.run(CamelApplication.class, args);
}
@Override
public void configure() throws Exception {
from("file:input?noop=true")
.log("Read from the input file")
.unmarshal(new XMLtoPOJO())
.log("Unmarshalled the xml")
.process(new MyProcessortoSetMoreDatatoPOJO())
.log("Enriched with more data in processor")
.to("file:destination")
.log("Written to output file");
}
}