« Return to Thread: [StompConnect] Problems with setup for SwiftMQ 7.2, JMS and Ruby

[StompConnect] Problems with setup for SwiftMQ 7.2, JMS and Ruby

by Maik Schmidt-3 :: Rate this Message:

Reply to Author | View in Thread

Hi!

I'd like to setup a messaging system consisting of a Java receiver and  
a Ruby sender.

I'm using SwiftMQ 7.2, which does not support STOMP, so I have to use  
StompConnect. Unfortunately, I am not able to get it up and running.  
Neither the Main program nor the dependency injection approach works.

Here's how I start the Main program:

#!/bin/bash
export CLASSPATH=bin:lib/commons-logging-1.1.jar
export CLASSPATH=$CLASSPATH:lib/jms.jar
export CLASSPATH=$CLASSPATH:lib/swiftmq.jar
export CLASSPATH=$CLASSPATH:lib/stompconnect-1.0.jar
export properties=-
Djava.naming.factory.initial=com.swiftmq.jndi.InitialContextFactoryImpl
export properties="$properties -Djava.naming.provider.url=smqp://
localhost:4001/host2=localhost;port2=4001;reconnect=true;maxretries=50"
java $properties org.codehaus.stomp.jms.Main tcp://localhost:61613  
ConnectionFactory

Attached you'll find a small Java program and a Spring configuration  
file that makes up the whole receiver process. When I start the server  
and try to send a message using the following Ruby program:

require 'rubygems'
require 'stomp'

user, password = '', ''
host, port = 'localhost', 61613
connection = Stomp::Connection.open user, password, host, port, false
destination = 'testqueue@router1'
options = { 'persistent' => 'false' }
message = 'Hello, world!!!!'
connection.send destination, message, options
connection.disconnect

I get the following error:

Mar 17, 2008 7:26:21 PM org.codehaus.stomp.jms.StompConnect  
createConnectionFactory
INFO: Looking up name: ConnectionFactory in JNDI InitialContext for  
JMS ConnectionFactory
Mar 17, 2008 7:26:21 PM org.codehaus.stomp.tcp.TcpTransportServer  
doStart
INFO: Listening for connections at: tcp://localhost:61613
Mar 17, 2008 7:28:52 PM org.codehaus.stomp.jms.ProtocolConverter  
onException
SEVERE: Caught: java.net.SocketException: Broken pipe
java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at  
org
.codehaus
.stomp.tcp.TcpBufferedOutputStream.flush(TcpBufferedOutputStream.java:
106)
        at java.io.DataOutputStream.flush(DataOutputStream.java:106)
        at org.codehaus.stomp.tcp.TcpTransport.onStompFrame(TcpTransport.java:
105)
        at  
org
.codehaus
.stomp.jms.ProtocolConverter.sendToStomp(ProtocolConverter.java:467)
        at  
org
.codehaus
.stomp.jms.ProtocolConverter.onStompFrame(ProtocolConverter.java:179)
        at org.codehaus.stomp.tcp.TcpTransport.run(TcpTransport.java:131)
        at java.lang.Thread.run(Thread.java:613)

I suppose that my STOMP request cannot be delegated to SwiftMQ for any  
reason.

I get the same result, when I do not use the Main class and uncomment  
the StompConnect bean in the Spring configuration file.

What am I doing wrong?

Cheers,

Maik



<?xml version="1.0" encoding="iso-8859-1"?>

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

  <bean id="orderReceiver" class="com.acme.messaging.OrderReceiver"/>

  <bean id="swiftmq-initial-context" class="javax.naming.InitialContext">
    <constructor-arg>
      <props>                                      
        <prop key="java.naming.provider.url">smqp://localhost:4001/host2=localhost;port2=4001;reconnect=true;maxretries=50</prop>
        <prop key="java.naming.factory.initial">com.swiftmq.jndi.InitialContextFactoryImpl</prop>
      </props>
    </constructor-arg>
  </bean>
       
  <bean id="mq-connection-factory" factory-bean="swiftmq-initial-context" factory-method="lookup">
    <constructor-arg value="QueueConnectionFactory"/>
  </bean>

  <bean id="order-receiver"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory"   ref="mq-connection-factory" />
    <property name="messageListener"     ref="orderReceiver" />
    <property name="destinationName"     value="testqueue@router1" />
    <property name="concurrentConsumers" value="1" />
    <property name="sessionTransacted"   value="true"/>
  </bean>
 
  <!--  
  <bean id="stompConnector" class="org.codehaus.stomp.jms.StompConnect" init-method="start">
    <property name="connectionFactory" ref="mq-connection-factory"/>
    <property name="uri"               value="tcp://localhost:61613"/>
  </bean>
  -->
</beans>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

OrderReceiver.java (1003 bytes) Download Attachment

 « Return to Thread: [StompConnect] Problems with setup for SwiftMQ 7.2, JMS and Ruby