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:gu...@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
<[email protected]> 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
> <[email protected]>wrote:
>
>> Our Java client implements the JMS API which you can then leverage through
>> Spring.
>>
>> Robbie
>>
>> > -----Original Message-----
>> > From: Rajiv Jacob Cheriyan [mailto:[email protected]]
>> > Sent: 14 September 2010 18:45
>> > To: [email protected]
>> > 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:[email protected]

Reply via email to