그런 다음 JDBC 구성 요소에 대한 경로를 구성하므로 SQL이 실행됩니다. 이전 단계에서 바인딩된 testdb 데이터 소스를 참조하는 방법에 유의하십시오.
또는 다음과 같이 Spring에서 DataSource 를 만들 수 있습니다.
끝점을 만들고 SQL 쿼리를 IN 메시지의 본문에 추가한 다음 교환을 보냅니다. 쿼리의 결과는 OUT 본문으로 반환됩니다.
한 번에 전체 ResultSet 대신 하나씩 행에 대해 작업하려면 다음과 같은 Splitter EIP를 사용해야 합니다.
from("direct:hello")
// here we split the data from the testdb into new messages one by one
// so the mock endpoint will receive a message per row in the table
// the StreamList option allows to stream the result of the query without creating a List of rows
// and notice we also enable streaming mode on the splitter
.to("jdbc:testdb?outputType=StreamList")
.split(body()).streaming()
.to("mock:result");
from("direct:hello")
// here we split the data from the testdb into new messages one by one
// so the mock endpoint will receive a message per row in the table
// the StreamList option allows to stream the result of the query without creating a List of rows
// and notice we also enable streaming mode on the splitter
.to("jdbc:testdb?outputType=StreamList")
.split(body()).streaming()
.to("mock:result");
Copy to ClipboardCopied!Toggle word wrapToggle overflow