Ruby client stompconnect IBM WebSphere MQ

View: New views
1 Messages — Rating Filter:   Alert me  

Ruby client stompconnect IBM WebSphere MQ

by Sylvain Perez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have been trying StompConnect with WebSphere MQ and ActiveMessaging.
Thanks to Andrew Kuklewicz for his great tutorial at InfoQ and James Strachan for the awesome work.
I actually fall on several issues :

1) Sending a message only with JMS over MQ was fine with this configuration of the ConnectionFactory :
  MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
  factory.setQueueManager("MY_QUEUE_MANAGER");

But when using StompConnect with the factory created as above :
  StompConnect connect = new StompConnect(factory);
  connect.setUri("tcp://localhost:61613");
  connect.start();
  connect.join();

Then when I start my poller script, StompConnect gives this error :
  [ansport: tcp:///127.0.0.1:1801] ProtocolConverter              DEBUG <<<< ERROR headers: {message=MQJMS2013: invalid security authentication supplied for MQQueueManager}

Googling around gave me an idea.
If I set the TransportType of my factory to CLIENT instead of the default value BINDINGS :
  factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);

Then StompConnect accepts the connection from the poller script and manages to use my ConnectionFactory to connect to the QueueManager.

Why does StompConnect needs such a settings where a simple JMS program does not ?

2) Happy after fixing issue 1), it was time to send a message from my rails app.
But unfortunately StompConnect gave me that error :
  [ansport: tcp:///127.0.0.1:1982] ProtocolConverter              DEBUG <<<< ERROR headers: {message=MQJMS1058: Invalid message property name: content-type}  

Googling around didn't help this time. Based on the JMS Specs, content-type should be a valid message property name. I saw that Chalie had the same problem. So, would you plan a release that will prevent the transmission of that property or would you suggest people having the problem to fix it by their own ?

3) After issue 2), if I start the poller script (with the "run" command since I'm on Windows and fork does not exist), then I get the following error from StompConnect :
  [ansport: tcp:///127.0.0.1:2017] ProtocolConverter              DEBUG <<<< ERROR headers: {message=MQJMS2005: failed to create MQQueueManager for 'localhost:QM_JAVA'}

4) After issue 3), if I restart StompConnect and the poller script, I keep getting the error message described in 3).
I have no other solution than to restart my QueueManager or to start my simple JMS program. After that, the executing the poller script gives no error.

5) If I have StompConnect and the poller script correctly connected, then if I kill the poll script I get the following error message from StompConnect :
  [ansport: tcp:///127.0.0.1:2027] ProtocolConverter              DEBUG Closing session: org.codehaus.stomp.jms.StompSession@e7b241 with ack mode: 1
  2007.04.13 13:02:16 MQJMS1023E rollback failed
  [ansport: tcp:///127.0.0.1:2027] ProtocolConverter              ERROR Caught: java.net.SocketException: Connection reset
  java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(Unknown Source)
  at org.codehaus.stomp.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
        at org.codehaus.stomp.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
        at java.io.DataInputStream.readByte(Unknown Source)
        at org.codehaus.stomp.StompMarshaller.readLine(StompMarshaller.java:189)
        at org.codehaus.stomp.StompMarshaller.unmarshal(StompMarshaller.java:94)
        at org.codehaus.stomp.tcp.TcpTransport.run(TcpTransport.java:130)
        at java.lang.Thread.run(Unknown Source)

6) After issue 5), if I restart the poller script and decide to use the rails app to send a message then StompConnect loops with this error message :
  [ansport: tcp:///127.0.0.1:2032] ProtocolConverter              DEBUG <<<< ERROR headers: {message=MQJMS2005: failed to create MQQueueManager for 'localhost:QM_JAVA'}
  [ansport: tcp:///127.0.0.1:2032] TcpTransport                   DEBUG Stopping transport tcp:///127.0.0.1:2032
  [ansport: tcp:///127.0.0.1:2032] ProtocolConverter              ERROR Caught: java.net.SocketException: No buffer space available (maximum connections reached?): recv failed
  java.net.SocketException: No buffer space available (maximum connections reached?): recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at org.codehaus.stomp.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
        at org.codehaus.stomp.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
        at java.io.DataInputStream.readByte(Unknown Source)
        at org.codehaus.stomp.StompMarshaller.readLine(StompMarshaller.java:189)
        at org.codehaus.stomp.StompMarshaller.unmarshal(StompMarshaller.java:94)
        at org.codehaus.stomp.tcp.TcpTransport.run(TcpTransport.java:130)
        at java.lang.Thread.run(Unknown Source)

7) I have a final question regarding encoding. StompConnect mentions in its logs :
  [ansport: tcp:///127.0.0.1:2181] ProtocolConverter              DEBUG >>>> CONNECT headers: {login=, content-type=text/plain; charset=UTF-8, passcode=, content-length=0}

Do I have to provide any settings to my ConnectionFactory regarding utf-8 encoding ?

Please, your comments / help are welcome.
I apologize if I made here and there english errors.

Cheers,

  Sylvain