Return to Snippet

Revision: 4882
at January 26, 2008 18:12 by narkisr


Initial Code
<!-- our MDP -->
<bean id="messageListener" class="server.mdpojos.MDPojo"/>

<!-- The Spring JMS container -->
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  <property name="connectionFactory" ref="connectionFactory"/>
  <property name="destination">
    <bean id="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName" value="queue/DummyQueue"/>
     </bean>
   </property>
  <property name="messageListener" ref="messageListener"/>
</bean>

<!-- A JNDI Template which is used to get a reference to the JBoss connection factory -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
   <property name="environment">
     <props>
      <prop key="java.naming.provider.url">localhost:1099</prop>
      <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
      <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
     </props>
   </property>
</bean>

<!-- The JBoss connection factory -->
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiTemplate">
     <ref bean="jndiTemplate"/>
   </property>
   <property name="jndiName">
     <value>ConnectionFactory</value>
   </property>
</bean>

Initial URL


Initial Description
A complete example of how to configure a Spring Message Driven Pojo (MDP)  with a JBoss JMS Queue as its destination, this can be used with JMSTemplate.

Initial Title
Spring MDP example

Initial Tags


Initial Language
Java