64.3. 사용법
CDI 생산자 방법은 Camel 경로의 참조 URI 체계를 사용하여 끝점을 Camel 레지스트리에 바인딩하는 데 사용할 수 있습니다.
예를 들어 엔드포인트 빈을 생성하려면 다음을 수행합니다.
@ApplicationScoped
public class MyEndpointProducers {
@Inject
CamelContext context;
@Singleton
@Produces
@Named("endpoint1")
public Endpoint directStart() {
return context.getEndpoint("direct:start");
}
@Singleton
@Produces
@Named("endpoint2")
public Endpoint logEnd() {
return context.getEndpoint("log:end");
}
}
ref: Camel 레지스트리에 바인딩된 CDI 빈의 이름을 나타냅니다.
public class MyRefRoutes extends RouteBuilder {
@Override
public void configure() {
// direct:start -> log:end
from("ref:endpoint1")
.to("ref:endpoint2");
}
}