Маршрутизация очередей с помощью Service Mix - PullRequest
0 голосов
/ 15 марта 2012

Я пытаюсь настроить Apache ServiceMix для реализации топологии сети ниже:

enter image description here

Я очень новичок в Service Mix, Camel, ActiveMq и т. Д., И основная проблема, которую я пытаюсь решить, - это направить сообщения из очереди вывода DC1.ActiveMqBroker в очередь ввода DC2.ActiveMqBroker. *

Я уверен, что это должно быть легко. Может ли кто-нибудь указать мне хорошую статью или написать грубый фрагмент конфигурации (в Spring / Blueprint, не имеет значения)?

UPDATE:

Извините за длинный текст, но я не вижу другого способа рассказать о моей проблеме.

Мой пример конфигурации:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="dc2" dataDirectory="${karaf.data}/activemq/dc2" useShutdownHook="false">
    <destinationPolicy>
        <policyMap>
            <policyEntries>
                <policyEntry queue="input" producerFlowControl="true" memoryLimit="1mb"/>
                <policyEntry queue="output" producerFlowControl="true" memoryLimit="1mb"/>
            </policyEntries>
        </policyMap>
    </destinationPolicy> 
    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>
    <persistenceAdapter>
        <kahaDB directory="${karaf.data}/activemq/dc2/kahadb"/>
    </persistenceAdapter>
    <transportConnectors>
        <transportConnector name="openwire" uri="tcp://localhost:61619"/>
    </transportConnectors>
</broker>

<bean id="dc1activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://localhost:61619" />
</bean>

<bean id="dc2activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://localhost:61618" />
</bean>

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route>
        <from uri="dc1activemq:queue:output"/>
        <log message="Took message from dc1 to dc2"/>
        <to uri="dc2activemq:queue:input"/>
    </route>
</camelContext>

И я постоянно получаю следующую ошибку:

08:06:40,739 | INFO  | rint Extender: 3 | Activator                        | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load
08:06:40,740 | INFO  | rint Extender: 3 | Activator                        | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load
08:06:40,741 | INFO  | rint Extender: 3 | Activator                        | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Found 1 @Converter classes to load
08:06:40,741 | INFO  | rint Extender: 3 | Activator                        | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Found 2 @Converter classes to load
08:06:40,749 | INFO  | rint Extender: 3 | Activator                        | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Found 13 @Converter classes to load
08:06:40,754 | INFO  | rint Extender: 3 | BlueprintCamelContext            | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | JMX enabled. Using ManagedManagementStrategy.
08:06:40,758 | INFO  | rint Extender: 3 | BlueprintCamelContext            | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Apache Camel 2.6.0 (CamelContext: 211-camel-165) is starting
08:06:42,364 | INFO  | rint Extender: 3 | BlueprintCamelContext            | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Route: route55 started and consuming from: Endpoint[dc1activemq://queue:output]
08:06:42,364 | INFO  | rint Extender: 3 | BlueprintCamelContext            | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Total 1 routes, of which 1 is started.
08:06:42,365 | INFO  | rint Extender: 3 | BlueprintCamelContext            | ?                                   ? | 68 - or
g.apache.camel.camel-core - 2.6.0 | Apache Camel 2.6.0 (CamelContext: 211-camel-165) started in 1.606 seconds
08:06:48,379 | WARN  | tenerContainer-1 | DefaultMessageListenerContainer  | ?                                   ? | 77 - or
g.springframework.jms - 3.0.5.RELEASE | Could not refresh JMS Connection for destination 'output' - retrying in 5000 ms. Cau
se: Could not connect to broker URL: tcp://localhost:61619. Reason: java.net.ConnectException: Connection refused: connect
08:06:54,381 | WARN  | tenerContainer-1 | DefaultMessageListenerContainer  | ?                                   ? | 77 - or
g.springframework.jms - 3.0.5.RELEASE | Could not refresh JMS Connection for destination 'output' - retrying in 5000 ms. Cau
se: Could not connect to broker URL: tcp://localhost:61619. Reason: java.net.ConnectException: Connection refused: connect

1 Ответ

1 голос
/ 15 марта 2012

Я предполагаю, что у вас есть представление о том, как Camel запускается в ServiceMix, и у вас есть несколько (по крайней мере) проверочных маршрутов. Если нет, начинайте там .Также предполагается, что вы знаете URL-адреса двух брокеров сообщений и что они уже настроены.

Учитывая это, одним из решений является регистрация двух ActiveMQComponents:

<bean id="dc1activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
   <property name="brokerURL" value="tcp://DC1BrokerLocation:12345" />
</bean>

<bean id="dc2activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
   <property name="brokerURL" value="tcp://DC2BrokerLocation:12345" />
</bean>

И затемв вашем верблюжьем контексте:

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
   <route>
      <from uri="dc1activemq:queue:whateverTheOutQueueIsCalled"/>
      <log message="Took message from dc1 to dc2"/>
      <to uri="dc2activemq:queue:whateverTheInQueueIsCalled"/>
   </route>
   <route>
      <from uri="dc2activemq:queue:whateverTheOutQueueIsCalled"/>
      <log message="Took message from dc2 to dc1"/>
      <to uri="dc1activemq:queue:whateverTheInQueueIsCalled"/>
   </route>
<camelContext>
...