We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

narkisr on 01/26/08


Tagged

spring JMS MDP


Versions (?)


Spring MDP example


Published in: Java 


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.


  1. <!-- our MDP -->
  2. <bean id="messageListener" class="server.mdpojos.MDPojo"/>
  3.  
  4. <!-- The Spring JMS container -->
  5. <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  6. <property name="connectionFactory" ref="connectionFactory"/>
  7. <property name="destination">
  8. <bean id="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
  9. <property name="jndiName" value="queue/DummyQueue"/>
  10. </bean>
  11. </property>
  12. <property name="messageListener" ref="messageListener"/>
  13. </bean>
  14.  
  15. <!-- A JNDI Template which is used to get a reference to the JBoss connection factory -->
  16. <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
  17. <property name="environment">
  18. <props>
  19. <prop key="java.naming.provider.url">localhost:1099</prop>
  20. <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
  21. <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
  22. </props>
  23. </property>
  24. </bean>
  25.  
  26. <!-- The JBoss connection factory -->
  27. <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  28. <property name="jndiTemplate">
  29. <ref bean="jndiTemplate"/>
  30. </property>
  31. <property name="jndiName">
  32. <value>ConnectionFactory</value>
  33. </property>
  34. </bean>

Report this snippet 

You need to login to post a comment.