Using: qpid-broker 0.32, qpid-jms-client-0.3.0
Hello. New user of the AMQP protocol. I'm attempting to create and bind a queue to an already existing fanout exchange through JNDI, then connect through a JMS client. If I create the exchange, the queue, and bind it directly from the webPortal everything works fine. If I create just the exchange through the webPortal then use my jndi properties file to create and bind the queue, it's unable to resolve and I get a javax.jms.InvalidDestinationException. What am I doing wrong?
I have setup a custom fanout exchange called TEST_FANOUT_EXCHANGE on localhost:5672. Virtual hosts are all default.
My jndi.properties file is:
java.naming.factory.initial = org.apache.qpid.jms.jndi.JmsInitialContextFactory connectionfactory.qpidConnectionfactory = amqp://localhost:5672
queue.fanoutQueue = messagequeue destination.fanoutExchange = fanout://TEST_FANOUT_EXCHANGE//messagequeue?durable='true'&autodelete='true'&exclusive='false'
Java code is as follows:
Properties properties = new Properties();
InputStream input = new FileInputStream("conf/jndi.properties");
properties.load(input);
Context context = new InitialContext(properties);
ConnectionFactory connectionFactory
= (ConnectionFactory) context.lookup("qpidConnectionfactory");
Connection connection = connectionFactory.createConnection("guest","guest");
connection.start();
Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
Queue destination = (Queue) context.lookup("fanoutQueue");
MessageConsumer messageConsumer = session.createConsumer(destination);
According to the documentation, if the exchange or queue does not exist, it will get created and binded automatically. So why isn't this happening?
Thank you!
Dennis