272.3. 런타임 조회

이 구성 요소는 런타임에 URI를 계산할 수 있는 레지스트리에서 끝점의 동적 검색이 필요할 때 사용할 수 있습니다. 그런 다음 다음 코드를 사용하여 끝점을 조회할 수 있습니다.

// lookup the endpoint
String myEndpointRef = "bigspenderOrder";
Endpoint endpoint = context.getEndpoint("ref:" + myEndpointRef);

Producer producer = endpoint.createProducer();
Exchange exchange = producer.createExchange();
exchange.getIn().setBody(payloadToSend);
// send the exchange
producer.process(exchange);

또한 다음과 같이 레지스트리에 정의된 끝점 목록이 있을 수 있습니다.

<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <endpoint id="normalOrder" uri="activemq:order.slow"/>
    <endpoint id="bigspenderOrder" uri="activemq:order.high"/>
</camelContext>