46.11. 명명된 매개변수 사용
아래 지정된 경로에서 projects 테이블에서 모든 프로젝트를 가져오려고 합니다. SQL 쿼리에는 두 개의 매개 변수, :#lic 및 :#min이 있습니다.
그런 다음 Camel은 메시지 본문 또는 메시지 헤더에서 이러한 매개변수를 조회합니다. 위의 예에서 named 매개변수의 경우 constant value
로 두 개의 헤더를 설정합니다.
from("direct:projects") .setHeader("lic", constant("ASF")) .setHeader("min", constant(123)) .to("sql:select * from projects where license = :#lic and id > :#min order by id")
from("direct:projects")
.setHeader("lic", constant("ASF"))
.setHeader("min", constant(123))
.to("sql:select * from projects where license = :#lic and id > :#min order by id")
메시지 본문이 java.util.Map
인 경우 명명된 매개 변수는 본문에서 가져옵니다.
from("direct:projects") .to("sql:select * from projects where license = :#lic and id > :#min order by id")
from("direct:projects")
.to("sql:select * from projects where license = :#lic and id > :#min order by id")