Using the broker InVM requires use of vm:// instead of amqp:// at the start of the connection URL. When using the broker InVM no TCP port is bound as you have noticed, since the traffic is passed directly by the Mina IO layer.
I would note however that InVM communication is currently only supported for an older protocol version and not the AMQP 0-10 protocol the client+broker use to communicate by default over TCP, so you wouldnt strictly be testing what your clients will actually be doing by using InVM. Some work has been undertaken on updating the InVM support, hopefully that gets onto trunk for Qpid 0.12. The mailing list archives are described here: http://qpid.apache.org/mailing_lists.html Robbie On 6 April 2011 13:45, Stijn Lievens <[email protected]> wrote: > Hi QPID developers, > > I am new to this list and messaging in general, so forgive me if my > question is obvious or has already been answered. [Is there a search-able > archive of this list available somewhere?] > > I have a Java program that relies on an AMQP broker for receiving (and > sending) messages. I would like to write a Junit test for particular parts > of this program. On my own computer I can of course use an external QPID > broker but I would like these Junit tests to work on whatever computer they > are being run on. I also don't want to depend on some remote QPID broker, as > this may cause problems when behind a firewall etc. > > To this end, I would like the ability to create a 'virtual' or 'in-memory' > broker prior to running the actual test. I think that this should be > possible with the QPID Java code. However, it doesn't quite work for me, as > I cannot connect to the broker I supposedly created. > > The code I wrote is in VirtualBroker.java. When I run it, the output is: > > [Broker] BRK-1001 : Startup : Version: 0.8 Build: 1037942 > [Broker] BRK-1001 : Startup : Version: 0.8 Build: 1037942 > [main] ERROR manager.PrincipalDatabaseAuthenticationManager - Unable to > load custom SASL providers. Qpid custom SASL authenticators unavailable. > registry.getVirtualHostRegistry = > org.apache.qpid.server.virtualhost.VirtualHostRegistry@163956 > vhost.getName() = localhost > vhost.getName() = test > vhost.getName() = development > The port for the broker is 15672 > The version is 0.8 [Build: 1037942] > Broker started .... > Sleeping 5 seconds > Trying to create a connection > Exception in thread "main" javax.jms.JMSException: Error creating > connection: Connection refused > <stacktrace cut> > > Thus, it looks like I can create the in-memory broker, but I cannot connect > to it. Does a in-memory broker require a different kind of connection URL? > > That being said, when I check the 'open ports' on my system, then 15672 > (the one I specify in the configuration file) is not among those. Should it > be? > > If anyone could shed any light on what I am doing wrong that would be most > appreciated. > > Kind regards, > > Stijn > > PS. I attach the Java source code as well as the configuration files used. > > > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] >
