305.4.2. Camel SIP 구독자 생성

아래 예제에서 SIP 구독자는
사용자에게 "johndoe@localhost:5154"로 전송된 SIP 이벤트 게시를 수신하도록 생성됩니다.

  • Subscriber라는 SIP 스택 사용
  • agent@localhost:5152라는 Presence 에이전트 사용자로 등록
  • evtHdrName이라는 레지스트리 기반 eventHeader를 사용합니다. evtHdrName에는 se to "Event_A"라는 이벤트가 포함되어 있습니다.
  • evtId라는 레지스트리 기반 이벤트Id 사용
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // Create PresenceAgent
            from("sip://agent@localhost:5152?stackName=PresenceAgent&presenceAgent=true&eventHeaderName=evtHdrName&eventId=evtid")
                .to("mock:neverland");

            // Create Sip Consumer(Event Subscriber)
            from("sip://johndoe@localhost:5154?stackName=Subscriber&toUser=agent&toHost=localhost&toPort=5152&eventHeaderName=evtHdrName&eventId=evtid")
                .to("log:ReceivedEvent?level=DEBUG")
                .to("mock:notification");

        }
    };
}

Camel SIP 구성 요소에는 테스트 및 데모 목적으로만 사용할 수 있는 Presence 에이전트도 포함되어 있습니다. Presence Agent를 인스턴스화하는 예는 위에 나와 있습니다.

Presence Agent는 사용자 agent@localhost:5152로 설정되어 있으며 구독자와 게시자와 통신할 수 있습니다. 게시자뿐만 아니라 구독자와 별도의 SIP stackName이 있습니다. Camel Consumer로 설정되었지만 실제로 경로를 따라 "mock:neverland" 엔드포인트로 메시지를 보내지 않습니다.