2017-05-18 25 views
2

とActiveMQの私は、このトピックにかなり新たなんだといくつかの説明が必要...初心者:キャメル

我々は今、Apacheのキャメルのルーティングおよび処理を強化する必要があります実行しているのActiveMQ-サーバーを持っています。私たちの全体の構成はXMLベースです。

私の最初のアプローチは、activemq.xmlの最後に平文<import resource="camel.xml">を実行することでしたが、これは間違ったパスのようです。

これらは現在transortConnectorsです:

<transportConnectors> 
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> 
    <transportConnector name="openwire" uri="tcp://localdev:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="amqp" uri="amqp://localdev:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="stomp" uri="stomp://localdev:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="mqtt" uri="mqtt://localdev:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="ws" uri="ws://localdev:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="mqtt+ws" uri="ws://localdev:1884?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="vm" uri="vm://localdev" /> 
</transportConnectors> 

そして、これが私たちのcamel.xmlです:

<beans 
     xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation=" 
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> 

    <camelContext id="camel" depends-on="broker-localdev" xmlns="http://camel.apache.org/schema/spring"> 
     <route id="devRawMap"> 
      <description>Redirect for test message</description> 
      <from uri="activemq:topic:alpha.topic.DEV.INTERNAL.*.RAW"/> 
      <to uri="activemq:queue:alpha.queue.DEV"/> 
     </route> 
     <route id="liveMap"> 
      <description>Redirect for Live data</description> 
      <from uri="activemq:topic:devRoot.topic.LIVE.*.RAW"/> 
      <to uri="activemq:queue:devRoot.queue.LIVE"/> 
     </route> 
    </camelContext> 

    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" > 
     <property name="connectionFactory"> 
      <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
       <property name="brokerURL" value="vm://localdev?create=false"/> 
       <property name="userName" value="user"/> 
       <property name="password" value="pass"/> 
      </bean> 
     </property> 
    </bean> 
</beans> 

私が作るどのような構成では、メッセージがキューにトピックからルーティングされ、私は取得されていませんログメッセージ:

Broker localhost not started so using localdev instead 
Connector vm://localhost started 

私はこれに間違ったアプローチをしていますか?

すべてのヘルプは非常に

を高く評価している[EDIT 01]

は永続化された話題の多くを有することを多分問題ですRuntimeConfigurationPluginを使用してkahadb alognからロードbeingh? すべてのトピックがロードされ、作成されるまでには時間がかかります。特に、log4jをデバッグに設定する必要があります。 さらに、RuntimeConfigurationPluginでは、ブローカがinit中に "start = false"を設定する必要があります。 <import resource="camel.xml"/>を除去してactivemq.xmlに直接camel.xmlのコンテンツを追加することにより、

</broker> 
    <import resource="camel.xml"/> 
</beans> 

試み:camel.xmlactivemq.xmlと同じフォルダ内にある場合here

+0

あなたは ''を試すことができますか?また、完全なデバッグログを有効にして、 情報をさらに抽出できるかどうかを確認してください。 – Lucky

+0

あなたはどのバージョンのラクダを使用していますか?アプリケーションを起動すると、activemqでキューが作成されますか? – pvpkiran

+0

こんにちはすべてのキューとトピックが作成されます。私は外部nodejsスクリプトからstomp接続を介してキューを読むこともできます。しかし、私がCamelを始める瞬間、ログにはvm:// localhostが作成されているのが見えます。 – MPH

答えて

0

インポート<import resource="camel.xml"/>はこのようなブローカーと豆の要素の間でなければなりません見ます削除することによって<beans>要素:

</broker> 
    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" depends-on="broker-localdev" > 
     <route id="devRawMap"> 
      <description>Redirect for test message</description> 
      <from uri="activemq:topic:alpha.topic.DEV.INTERNAL.*.RAW"/> 
      <to uri="activemq:queue:alpha.queue.DEV"/> 
     </route> 
     <route id="liveMap"> 
      <description>Redirect for Live data</description> 
      <from uri="activemq:topic:devRoot.topic.LIVE.*.RAW"/> 
      <to uri="activemq:queue:devRoot.queue.LIVE"/> 
     </route> 
    </camelContext> 

    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" > 
     <property name="connectionFactory"> 
      <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
       <property name="brokerURL" value="tcp://localhost:61616"/> 
       <property name="userName" value="user"/> 
       <property name="password" value="pass"/> 
      </bean> 
     </property> 
    </bean> 
</beans> 
+0

あなたが言ったように、今例外がスローされます:クラスパスリソース[camel.xml]からのXMLドキュメントの行1は無効です。要素 'camelContext'の宣言が見つかりません。しかし私のスキーマの場所には 'http:// camel.apache.org/schema/spring/camel-spring.xsd'が含まれています。 – MPH

+0

私の答えは更新しました。すべての宛先がCamelによって作成されているかどうかを確認するAMQの開始後、他のクライアント接続の前にこれを確認する必要があるかどうか確認してください。 –

+0

編集を試す前にヒントになるかもしれません。監視されているキューにログが記録されます。発行:vm:// broker transport URIのlocalhost:vm:// localhost | org.apache.activemq.broker。TransportConnector | ActiveMQ VMTransport:vm:// localhost#5' – MPH