Monday, November 30, 2009

MDP with JBoss's JMS

<!-- our MDP -->
<bean id="messageListener" class="test.mdp.HelloBean"/>

<!-- 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/MyQueue"/>
    </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>

No comments:

Post a Comment

Followers