-
1. Re: PHP client is unable to connect to HornetQ instance via STOMP
jmesnil May 2, 2012 5:45 AM (in response to rmartinezjr)1 of 1 people found this helpfuldid you add a Stomp acceptor to HornetQ configuration? http://docs.jboss.org/hornetq/2.2.14.Final/user-manual/en/html/interoperability.html#stomp.native
-
2. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 8:06 AM (in response to jmesnil)Hi Jeff,
Yes. I had it enabled and I'm getting the following text in console:
* [main] 2-May 19:57:29,897 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c localhost:61613 for STOMP protocol
-
3. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 8:11 AM (in response to rmartinezjr)I even tried binding stomp on 127.0.0.1 and modified the php code to connect to the same IP and still no luck...
* [main] 2-May 19:57:29,897 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c 127.0.0.1:61613 for STOMP protocol
-
4. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 8:14 AM (in response to rmartinezjr)What version of HornetQ are you using?
Howard
-
5. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 8:26 AM (in response to rmartinezjr)Hello Howard,
I am using HornetQ Server version 2.2.14 Final
* [main] 2-May 20:22:25,274 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c 127.0.0.1:61613 for STOMP protocol
* [main] 2-May 20:22:25,274 INFO [HornetQServerImpl] Server is now live
* [main] 2-May 20:22:25,275 INFO [HornetQServerImpl] HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [b14e14f5-919e-11e1-8795-2f657509c14b]) started
I'm in the process of downloading OpenJDK to try to compile the sample Java-based STOMP-based application that ships with HornetQ to try to determine if this is a PHP client issue or not.
I have been reading a couple of threads that talks about using PHP with HornetQ with success so I am assuming that the current available module for PHP should work out of the box. I believe that the current PHP module understands STOMP 1.0 only.
-
6. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 9:15 AM (in response to rmartinezjr)1 of 1 people found this helpfulhmm, this doesn't look like a valid release. I didn't find a tag for it. Anyway I tried your script with latest HornetQ build and I think it works. The output is like
howard@howard-ThinkPad-W510$ php stomptest.php
object(StompFrame)#2 (3) {
["command"]=>
string(7) "MESSAGE"
["headers"]=>
array(7) {
["timestamp"]=>
string(13) "1335964232481"
["redelivered"]=>
string(5) "false"
["expires"]=>
string(1) "0"
["subscription"]=>
string(35) "subscription/jms.queue.ExampleQueue"
["priority"]=>
string(1) "4"
["message-id"]=>
string(2) "53"
["destination"]=>
string(22) "jms.queue.ExampleQueue"
}
["body"]=>
string(3) "bar"
}
Also don't use slash in the destionations. use . (dot) instead. And prefix the queue name with 'jms.queue.'.
I'd suggest you try the latest HornetQ.
Howard
-
7. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 9:22 AM (in response to gaohoward)ok I'm seeing there is a download link for 2.2.14. I'll try that too.
Howard
-
8. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 9:47 AM (in response to gaohoward)well no problem with 2.2.14 on my machine. Make sure you get the configuration correct.
-
9. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 12:25 PM (in response to rmartinezjr)Thanks Howard.
Interesting! I am trying to run HornetQ on an Ubuntu machine running as a VirtualBox instance. The Vbox instance has no active firewall whatsoever.
Below is a comparison between original configuration that shipped with the latest release versus modified configuration files (/media/DataHD/hornet-2.2.14-Final/config*).
rmartinez@vbox1:~/macbook-sites$ diff -rb hornetq-2.2.14.Final/config /media/DataHD/hornetq-2.2.14.Final/config
diff -rb hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-configuration.xml /media/DataHD/hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-configuration.xml
43a44,51
>
> <acceptor name="stomp-acceptor">
> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
> <param key="protocol" value="stomp"/>
> <param key="host" value="127.0.0.1" />
> <param key="port" value="61613"/>
> <param key="connection-ttl" value="20000"/>
> </acceptor>
diff -rb hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-users.xml /media/DataHD/hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-users.xml
4c4
< <defaultuser name="guest" password="guest">
---
> <defaultuser name="guest" password="guest123">
diff -rb hornetq-2.2.14.Final/config/stand-alone/non-clustered/jndi.properties /media/DataHD/hornetq-2.2.14.Final/config/stand-alone/non-clustered/jndi.properties
2a3
> ; java.naming.provider.url=jnp://localhost:1099
And the console messages are the following:
***********************************************************************************
java -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/twitter4j-core.jar:../lib/netty.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/hornetq-twitter-integration.jar:../lib/hornetq-spring-integration.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jms-client-java5.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-core-client.jar:../lib/hornetq-core-client-java5.jar:../lib/hornetq-bootstrap.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
* [main] 3-May 0:2:24,443 INFO [HornetQBootstrapServer] Starting HornetQ Server
* [main] 3-May 0:2:26,91 INFO [HornetQServerImpl] live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging)
* [main] 3-May 0:2:26,92 INFO [HornetQServerImpl] Waiting to obtain live lock
* [main] 3-May 0:2:26,120 INFO [JournalStorageManager] Using AIO Journal
* [main] 3-May 0:2:26,145 WARNING [HornetQServerImpl] Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
* [main] 3-May 0:2:26,550 INFO [AIOFileLockNodeManager] Waiting to obtain live lock
* [main] 3-May 0:2:26,550 INFO [AIOFileLockNodeManager] Live Server Obtained live lock
* [main] 3-May 0:2:29,545 INFO [HornetQServerImpl] trying to deploy queue jms.queue.DLQ
* [main] 3-May 0:2:29,617 INFO [HornetQServerImpl] trying to deploy queue jms.queue.ExpiryQueue
* [main] 3-May 0:2:29,791 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c localhost:5445 for CORE protocol
* [main] 3-May 0:2:29,792 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c 127.0.0.1:61613 for STOMP protocol
* [main] 3-May 0:2:29,793 INFO [NettyAcceptor] Started Netty Acceptor version 3.2.5.Final-a96d88c localhost:5455 for CORE protocol
* [main] 3-May 0:2:29,797 INFO [HornetQServerImpl] Server is now live
* [main] 3-May 0:2:29,797 INFO [HornetQServerImpl] HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [b14e14f5-919e-11e1-8795-2f657509c14b]) started
-
10. Re: PHP client is unable to connect to HornetQ instance via STOMP
jmesnil May 2, 2012 12:28 PM (in response to rmartinezjr)Raul Martinez wrote:
diff -rb hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-users.xml /media/DataHD/hornetq-2.2.14.Final/config/stand-alone/non-clustered/hornetq-users.xml
4c4
< <defaultuser name="guest" password="guest">
---
> <defaultuser name="guest" password="guest123">
You tried to connect to Stomp with credentials guest123 / guest123
$stomp = new Stomp('tcp://localhost:61613', 'guest123', 'guest123');
but from your config file, you should use guest / guest123.
Could you try it?
-
11. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 12:34 PM (in response to jmesnil)Hello Jeff,
Yeah. Sorry about that. I already updated the code to reflect the username that I have configured in hornet-users.xml. Still no luck, still getting "Server is not responding".
-
12. Re: PHP client is unable to connect to HornetQ instance via STOMP
rmartinezjr May 2, 2012 1:40 PM (in response to rmartinezjr)Following is a telnet session comparison between Apache Apollo and HornetQ. Apologies for doing the comparison but I just want to try out HornetQ stomp protocol really :-)
I am deliberately making sure that I get an ERROR message due to incorrect password.
Apache Apollo
rmartinez@vbox1:~$ telnet localhost 61613
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
CONNECT
login: guest
passcode: guest
request-id: 1
^@
ERROR
message:Authentication failed. Credentials=[user=guest]
HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122)
rmartinez@vbox1:~$ telnet localhost 61613
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
CONNECT
login: guest
passcode: guest
request-id: 1
^@
The HorneQ session did not acknowledge the CONNECT frame and I waited for a couple of minutes and still nothing.
I tested this scenario for HornetQ on the following instances:
Instance #1:
Ubuntu 10.04
Linux vbox1 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
OpenJDK runtime 1.11pre
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
VirtualBox
Instance #2:
CentOS 6
Linux vbox2 2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686 i686 i386 GNU/Linux
OpenJDK 1.7.4
OpenJDK Client VM build 14.0-b16, mixed mode
Instance #3:
Mac OS X Lion 10.7.3
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
The HornetQ behavior is the same. It don't get to see error response as an acknowledgement to CONNECT frame entered via a telnet session.
The library Stomp-PHP Library provided by Hiram Chirino and his team is also complaining about the server not acknowleding the connection request.
https://github.com/dejanb/stomp-php/blob/master/src/main/FuseSource/Stomp/Stomp.php#L210
-
13. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 9:48 PM (in response to rmartinezjr)Hmm, I use this stomp client.
http://pecl.php.net/package/stomp
Looks like you are using a different one. I'll try that.
Howard
-
14. Re: PHP client is unable to connect to HornetQ instance via STOMP
gaohoward May 2, 2012 10:41 PM (in response to rmartinezjr)I tried the php-stomp and I can run your script successfully. I think it may be the network settings of your virtual box that causes the problem.
Can you try it on a non-virtual machine?
Howard