1
votes

I am having an issue with communication between a php STOMP connection and a ActiveMQ broker running on a different server. The layout is as follows;

Server A has a simple php script containing the line;

$stomp = new Stomp('tcp://<ServerB>:61550');

Server B has an AMQ broker running with the following transportConnector setup;

<transportConnectors>
    <transportConnector name="tcp" uri="tcp://0.0.0.0:61500"/>
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61550"/>
    <transportConnector name="ssl" uri="ssl://0.0.0.0:61700?needClientAuth=true"/>
</transportConnectors>

Server B also has a Java client acting as a consumer for a number of queues.

The issue is this, when we run the script on ServerA it fails with the following error;

Fatal error: Uncaught exception 'StompException' with message 'Server is not responding'

And in the ActiveMQ logs on ServerB we get;

2014-07-01 11:33:32,754 | WARN | Transport Connection to: tcp://ServerA:48692 failed: java.io.IOException: Unknown data type: 69 | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///ServerA:48692@61500

2014-07-01 11:33:32,755 | WARN | Transport Connection to: tcp://ServerA:48692 failed: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: tcp://ServerA:48692 | org.apache.activemq.broker.TransportConnection.Transport | Async Exception Handler

I have deduced that the reason this is failing is that for some reason the STOMP request from A is getting picked up by the TCP listener on port 61500 instead of the STOMP listener on port 61550, and its fails due to a protocol mismatch.

I tried changing the tcp transportConnector with port 61500 to a stomp connector, which fixed the problem. But a number of other applications rely on 61500 being tcp so its not a solution.

I have been speaking to our sysadmins and they are certain the firewall is setup correctly, even so they disabled the firewall completely on ServerB and the same issue occurred so I don't know if that is part of the issue. We have another server with an almost identical activemq config setup (tcp on 61500 and stomp on 61550) which works fine, the difference is that is has a jetty config for the ActiveMQ web tool.

I'm not really sure what to try or how this could be happening. If anyone has any advice or can help in any way it would be greatly appreciated.

Probably related, but I don't know what these mean, here is telnet outputs;

ServerA -> ServerB 61550

telnet serverB 61550
Trying <serverB address>...
Connected to serverB.
Escape character is '^]'.
ðActiveMQ       Þ
MaxFrameSizÿÿÿ  CacheSize
CacheEnabledSizePrefixDisabled  MaxInactivityDurationInitalDelay'TcpNoDelayEnabledMaxInactivityDurationu0TightEncodingEnabledStackTraceEnabled

ServerA -> ServerB 61500

telnet serverB 61500
Trying <serverB address>...
Connected to serverB.
Escape character is '^]'.
ðActiveMQ       Þ
MaxFrameSizÿÿÿ  CacheSize
CacheEnabledSizePrefixDisabled MaxInactivityDurationInitalDelay'TcpNoDelayEnabledMaxInactivityDurationu0TightEncodingEnabledStackTraceEnabledConnection closed by foreign host.

ServerB localhost 61550

telnet localhost 61550
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

ServerB localhost 61500

telnet localhost 61500
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ðActiveMQ       Þ
MaxFrameSizÿÿÿ  CacheSize
CacheEnabledSizePrefixDisabled MaxInactivityDurationInitalDelay'TcpNoDelayEnabledMaxInactivityDurationu0TightEncodingEnabledStackTraceEnabledPuTTYConnection closed by foreign host.

The only mention I can find of these characters on the web is this post ActiveMQ remote connections refused despite 0.0.0.0 in broker URL.

We unfortunately dont run Karaf and I'm not sure how else it would apply to us. I cant find anything else listening on 61550.

netstat -tulpn | grep 61550
tcp6       0      0 :::61550                :::*                    LISTEN      12870/java

Thanks to anyone who has read through all this, trying to provide as much info as I can.

1

1 Answers

-2
votes

You seem to be using wrong URI to connect to STOMP connector.

Replace $stomp = new Stomp('tcp://<ServerB>:61550');

with

$stomp = new Stomp('stomp://<ServerB>:61550');

Observe the protocol is stomp, not tcp.