271.4. 연결 팩토리 사용

RabbitMQ에 연결하려면 다음과 같은 로그인 세부 정보를 사용하여 ConnectionFactory ( JMS와 동일)를 설정할 수 있습니다.

<bean id="rabbitConnectionFactory" class="com.rabbitmq.client.ConnectionFactory">
  <property name="host" value="localhost"/>
  <property name="port" value="5672"/>
  <property name="username" value="camel"/>
  <property name="password" value="bugsbunny"/>
</bean>

And then refer to the connection factory in the endpoint uri as shown below:

<camelContext>
  <route>
    <from uri="direct:rabbitMQEx2"/>
    <to uri="rabbitmq:ex2?connectionFactory=#rabbitConnectionFactory"/>
  </route>
</camelContext>

Camel 2.21 이후부터는 기본적으로 ConnectionFactory 가 자동으로 감지되므로 다음을 수행할 수 있습니다.

<camelContext>
  <route>
    <from uri="direct:rabbitMQEx2"/>
    <to uri="rabbitmq:ex2"/>
  </route>
</camelContext>