You need to change the port as well as the port given on that line is the openwire port on the broker. Port 61613 is the default stomp port. Try reading the comments in the main of the example they give examples of the correct uri for stomp and openwire.
On Fri, 2008-01-25 at 09:19 -0800, gustav.mauer wrote: > I have downloaded and compiled activemq-cpp-2.1.3-src on Windows using Visual > Studio 2005 using the supplied solution. I have compiled and executed the > demo in src\examples and it works fine. > > However, when I change line 333 of src\examples\main.cpp to: > "?wireFormat=stomp" > and recompile and run the demo again exactly as I did a couple of minutes > previously without the change, I get: > > C:\test\activemq-cpp-2.1.3-src\vs2005-build\Debug>vs2005-activemq-example.exe > ===================================================== > Starting the example: > ----------------------------------------------------- > WARNING: activemq::io::SocketInputStream::read - The connection is broken > FILE: ..\src\main\activemq\network\SocketInputStream.cpp, LINE: 156 > FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 199 > FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 83 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 216 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 120 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 71 > FILE: ..\src\main\activemq\transport\IOTransport.cpp, LINE: 175 > - tid: 244 > StompConnector::connect - Response not a connected response > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 205 > > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 236 > > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 145 > > FILE: ..\src\main\activemq\core\ActiveMQConnectionFactory.cpp, LINE: > 173 > > ^C > C:\test\activemq-cpp-2.1.3-src\vs2005-build\Debug> > > It expectedly hangs at that point since no messages are being sent and I > have to press Ctrl-C then to get control back. Changing the line back and > running it again, it works again. > > Am I enabling Stomp correctly? What else should I change please? > > ------------------------------------------------------------------------------------------- > > Here is also the output from a run with the following enabled: > "&transport.commandTracingEnabled=true" > "&transport.tcpTracingEnabled=true"; > > C:\test\activemq-cpp-2.1.3-src\vs2005-build\Debug>vs2005-activemq-example.exe > ===================================================== > Starting the example: > ----------------------------------------------------- > INFO: *** BEGIN SENDING ONEWAY COMMAND *** > <STOMP-COMMAND class=class > activemq::connector::stomp::commands::ConnectCommand> > > Begin Class activemq::util::Properties: > properties[client-id] = a81f22b5-f744-43ec-8b8e-dfece135a780 > End Class activemq::util::Properties: > <STOMP-BODY numBytes=0></STOMP-BODY> > </STOMP-COMMAND> > *** END SENDING ONEWAY COMMAND *** - tid: 4956 > INFO: TCP Trace: Reading: > [0000 00ae 0141 6374 6976 654d 5100 0000 0301 0000 009c 0000 0007 0014 5469 > 6768 > 7445 6e63 6f64 696e 6745 6e61 626c 6564 0101 0009 4361 6368 6553 697a 6505 > 0000 > 0400 0011 5463 704e 6f44 656c 6179 456e 6162 6c65 6401 0100 1253 697a 6550 > 7265 > 6669 7844 6973 6162 6c65 6401 0000 1153 7461 636b 5472 6163 6545 6e61 626c > 6564 > 0101 0015 4d61 7849 6e61 6374 6976 6974 7944 7572 6174 696f 6e06 0000 0000 > 0000 > 7530 000c 4361 6368 6545 6e61 626c 6564 0101 ] len: 178 bytes - tid: 3604 > INFO: TCP Trace: Writing: > [434f 4e4e 4543 540a 636c 6965 6e74 2d69 643a 6138 3166 3232 6235 2d66 3734 > 342d > 3433 6563 2d38 6238 652d 6466 6563 6531 3335 6137 3830 0a0a 000a ] len: 58 > byte > s - tid: 4136 > INFO: TCP Trace: Reading: > [00] len: 1 bytes - tid: 3604 > WARNING: activemq::io::SocketInputStream::read - An established connection > was a > borted by the software in your host machine. > > FILE: ..\src\main\activemq\network\SocketInputStream.cpp, LINE: 167 > FILE: > c:\test\activemq-cpp-2.1.3-src\src\main\activemq/io/FilterInputStr > eam.h, LINE: 117 > FILE: ..\src\main\activemq\io\LoggingInputStream.cpp, LINE: 63 > FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 199 > FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 83 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 216 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 120 > FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, > LINE: > 71 > FILE: ..\src\main\activemq\transport\IOTransport.cpp, LINE: 175 > - tid: 3604 > INFO: *** BEGIN SENDING ONEWAY COMMAND *** > <STOMP-COMMAND class=class > activemq::connector::stomp::commands::DisconnectComma > nd> > Begin Class activemq::util::Properties: > End Class activemq::util::Properties: > <STOMP-BODY numBytes=0></STOMP-BODY> > </STOMP-COMMAND> > *** END SENDING ONEWAY COMMAND *** - tid: 4956 > INFO: TCP Trace: Writing: > [4449 5343 4f4e 4e45 4354 0a0a 000a ] len: 14 bytes - tid: 4136 > INFO: TCP Trace: Writing: > [4449 5343 4f4e 4e45 4354 0a0a 000a ] len: 14 bytes - tid: 4956 > StompConnector::connect - Response not a connected response > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 205 > > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 236 > > FILE: ..\src\main\activemq\connector\stomp\StompConnector.cpp, LINE: > 145 > > FILE: ..\src\main\activemq\core\ActiveMQConnectionFactory.cpp, LINE: > 173 > > ^C > C:\test\activemq-cpp-2.1.3-src\vs2005-build\Debug> >