简体   繁体   中英

cant' get camel route to JMs active mq working

First user of camel/JMS/acivemq.

I set up a jms camel route and I'm trying to send as test text and see it in the active mq GUI http://127.0.0.1:8161/admin/topics.jsp but I am not seeing anything. This is my first time trying to get this all to work and really need to see something in active mq to prove that this is working correctly.

Here is the camel route

     <cm:property-placeholder persistent-id="com.srcinc.ogre.alerts">
    <cm:default-properties>
      <cm:property name="jmsHostName" value="localhost" />
      <cm:property name="jmsPort" value="61616" />
      <cm:property name="jmsUserName" value="system" />
      <cm:property name="jmsPassword" value="manager" />
    </cm:default-properties>
  </cm:property-placeholder>
  <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://${jmsHostName}:${jmsPort}" />
    <property name="userName" value="${jmsUserName}" />
    <property name="password" value="${jmsPassword}" />
  </bean>
  <bean id="pooledJmsConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
    init-method="start" destroy-method="stop">
    <property name="maxConnections" value="8" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
  </bean>
  <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="pooledJmsConnectionFactory" />
    <property name="concurrentConsumers" value="10" />
  </bean>
  <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsConfig" />
  </bean>
  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route id="AlertProcessorJMSDistributionRoute">
      <from uri="vm:send-jms-alert?multipleConsumers=true" />
      <to uri="activemq:topic:Alerts" />
    </route>
  </camelContext>

Here is my Java code that references the appropriate camel route.

   private static final String VM__JMS_ROUTE = "vm::send-jms-alert";
    private ProducerTemplate mProducer;
    mProducer  = new DefaultCamelContext().createProducerTemplate();
    mProducer.sendBody(VM__JMS_ROUTE, "Testing 123");

在您的Java代码中,您应该只有一个冒号vm:send-jms-alert而不是vm::send-jms-alert

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM