Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Camel and Stomp

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?

like image 630
John Jesus Avatar asked Feb 23 '13 19:02

John Jesus


1 Answers

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.

like image 157
Petter Nordlander Avatar answered Sep 21 '22 11:09

Petter Nordlander