qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Kennedy <andrewinternatio...@gmail.com>
Subject Re: QPID Integration with Spring framework
Date Wed, 15 Sep 2010 11:22:03 GMT
Hi.

One way to use Qpid with Spring is to get your connection factory
using JNDI, with either a jndi.properties file containing a
connectionFactory line:

    java.naming.factory.initial =
org.apache.qpid.jndi.PropertiesFileInitialContextFactory
    connectionfactory.testconnectionfactory =
amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'&maxprefetch='1'

or getting it from your application server, and using it like this:

	<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
		<property name="environment">
			<props>
				<prop key="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</prop>
			</props>
		</property>
	</bean>

	<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
		<property name="targetConnectionFactory" ref="qpidConnectionFactory" />
		<property name="sessionCacheSize" value="10" />
	</bean>

	<bean id="qpidConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiTemplate" ref="jndiTemplate" />
		<property name="jndiName" value="testconnectionfactory" />
	</bean>

Once you have the connection factory, you can use it in a JmsTemplate
or any of the other Spring JMS classes:

	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="connectionFactory" />
		<property name="sessionTransacted" value="true" />
	</bean>

Andrew.
--
-- andrew d kennedy ? edinburgh : +44 7941 197 134

On 15 September 2010 10:02, Marnie McCormack
<marnie.mccormack@googlemail.com> wrote:
> There's an example config for Qpid with spring here:
>
> https://cwiki.apache.org/qpid/qpid-java-faq.html#QpidJavaFAQ-I%2527musingSpringandWeblogiccanyouhelpmewiththeconfigurationformovingovertoQpid
> Marnie
> On Tue, Sep 14, 2010 at 11:24 PM, Robbie Gemmell
> <robbie.gemmell@gmail.com>wrote:
>
>> Our Java client implements the JMS API which you can then leverage through
>> Spring.
>>
>> Robbie
>>
>> > -----Original Message-----
>> > From: Rajiv Jacob Cheriyan [mailto:rajivjacob@gmail.com]
>> > Sent: 14 September 2010 18:45
>> > To: users@qpid.apache.org
>> > Subject: QPID Integration with Spring framework
>> >
>> > Hi,
>> >
>> > Can anyone give me pointers for QPID integration with Spring framework.
>> >
>> > Thanks,
>> > Rajiv.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message