Question

I'm developing a solution whose architecture is:

  PHP -> JMS -> Camel -> several web services and endpoints.

According to: http://activemq.apache.org/php.html

... I ought to use the PHP STOMP client to use JMS. That works great.

I also used the ActiveMQ STOMP Java client to receive from JMS.

But, I want to use Camel for routing the JMS messages. I can't seem to get Camel to work with JMS / Stomp.

I took a look at https://github.com/fusesource/stompjms

... but I am not sure how to get that to work with Camel.

I also tried a Spring camel-context.xml with a brokerURL specifying STOMP:

  <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
      <property name="connectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
              <property name="brokerURL" value="stomp://localhost:61613" />
              <property name="userName" value="admin" />
              <property name="password" value="AmChamDev" />
          </bean>
      </property>
  </bean>

... but, that results in:

  [ #0 - JmsConsumer[/queue/test]] ultJmsMessageListenerContainer WARN  Could not 
  refresh JMS Connection for destination '/queue/test' - retrying in 5000 ms. 
  Cause: Could not create Transport. 
  Reason: java.io.IOException: Transport scheme NOT recognized: [stomp]

Any ideas on how to get Camel to work with JMS / Stomp?

Was it helpful?

Solution

You have to go with the open wire transport when using the JMS/ActiveMQ component.

tcp://localhost:61616 or what have you.

But don't worry. Even if you send messages to ActiveMQ using STOP (or any other of the available transports), you can receive the very same message using the JMS api (and hence the ActiveMQ component in Camel) using the default (open wire) transport.

OTHER TIPS

According to Camel docs http://camel.apache.org/stomp.html you need to include additional dependency:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-stomp</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top