qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guenther <GM...@fugro.be>
Subject Re: AMQP_1.0 activemq server side context.xml configuration spring
Date Wed, 23 Oct 2013 10:16:01 GMT
To answer my own question, this is how I made the "Hello World" example work
in my environment:

On the client side, the main problem was the destination which in the
original code goes like this:

Destination destination = (Destination) context.lookup("topicExchange");

This actually will create a DestinationImpl - object. 

I had to change this to 
Destination destination = session.createQueue("businessRequestQueue");
to create a QueueImpl instead of a DestinationImpl for my specific
destination which has the physical name "businessRequestQueue". 
(I didn't know how to make the PropertiesFileInitialContextFactory do this,
so I "hardcoded" it).

On the server side of my real application (which I used to try out the
"Hello world") I replaced the context.xml which I mentioned in my question
by the following: 

<Context reloadable="true">
	<Resource name="jms/ConnectionFactory" auth="Container"
	   type="org.apache.qpid.amqp_1_0.jms.ConnectionFactory"
	   description="JMS Connection Factory"
       factory="com.fugro.gwf.server.jmssender.AMQFactory"
	   brokerURL="vm:broker:(amqp://127.0.0.1:5672)?persistent=false"/>
</Context>

This uses a custom JNDI factory named AMQFactory (because there is not
default constructor in 
org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl) whose code is the
following: 

public class AMQFactory implements ObjectFactory 
{
	@Override
	public Object getObjectInstance(Object obj, Name name, Context nameCtx,
			Hashtable<?, ?> environment) throws Exception 
	{
		if (name.get(0).equals("ConnectionFactory"))
			return new ConnectionFactoryImpl("localhost", 5672,"", "");
		
		return null;
	}
}

Now everything finally works. 

Any comments about other experiences are welcome!

G√ľnther




--
View this message in context: http://qpid.2158936.n2.nabble.com/AMQP-1-0-activemq-server-side-context-xml-configuration-spring-tp7599690p7599828.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message