If you're using the JNDI to lookup a connection factory and then create a
connection from that factory, why the need for these two statements?
broker = BrokerFactory.createBroker(new URI("xbean:activemq.xml"));
broker.start();
If you set up your default provider url in the JNDI as follows
java.naming.provider.url = vm://ytsvmx02s?brokerConfig=xbean:activemq.xml
then this will start your ytsvmx02s embedded broker
// create a new intial context, which loads from jndi.properties file
context = new javax.naming.InitialContext();
// lookup the connection factory
qcf = (javax.jms.ConnectionFactory)context.lookup("ConnectionFactory");
// connect to and boot the embedded broker
connection = qcf.createConnection("admin", "admin");
Why do you have a transport connector with a 'vm' uri? The vm connector is
used by clients to connect to an embedded broker.
http://activemq.apache.org/vm-transport-reference.html
Joe
Eric-AWL wrote:
>
> The hostname of the first server (client process) is ytsvmx01s, the second
> one (server process) is ytsvmx02s
>
> here is an extract of my "vm connection"
>
>
> javax.jms.Connection connection;
> BrokerService broker;
>
> .....
>
> // create a new intial context, which loads from
> jndi.properties file
> context = new javax.naming.InitialContext();
>
> // lookup the connection factory
> broker = BrokerFactory.createBroker(new
> URI("xbean:activemq.xml"));
> broker.start();
>
> // lookup the connection factory
> qcf =
> (javax.jms.ConnectionFactory)context.lookup("ConnectionFactory");
> // qcf = new
> ActiveMQConnectionFactory("vm://localhost?brokerConfig=xbean:activemq.xml");
>
> connection = qcf.createConnection("admin", "admin");
> ....
>
>
>
> here is an extract of my file activemq.xml
>
> <broker brokerName="${hostname}" useJmx="true"
> xmlns="http://activemq.org/config/1.0" persistent="false">
> .....
> <transportConnectors>
> <transportConnector name="tcp" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
> <transportConnector name="vm" uri="vm://${hostname}"/>
> </transportConnectors>
>
> <networkConnectors>
> <networkConnector name="pool"
> uri="static://(tcp://ytsvmx01s:61616,tcp://ytsvmx02s:61616)"
> conduitSubscriptions="false" dynamicOnly="true" />
> </networkConnectors>
> ....
>
>
> here is my jndi.properties file (for ytsvmx02s, the same with
> vm://ytsvmx01s for the other server)
>
> java.naming.factory.initial =
> org.apache.activemq.jndi.ActiveMQInitialContextFactory
>
> # use the following property to configure the default connector
> java.naming.provider.url = vm://ytsvmx02s
>
> # register some queues in JNDI using the form
> # queue.[jndiName] = [physicalName]
> queue.Queue1 = Queue1
> queue.Queue2 = Queue2
> queue.Queue3 = Queue3
>
>
--
View this message in context:
http://www.nabble.com/%22Embedded-broker%22%2C-%22network-of-brokers%22-and-%22temporary-queues%22-tp15023996s2354p15044156.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.