Spring JMS Template simple configuration


/ Published in: XML
Save to your folder(s)

A basic configuration for Spring JMS template


Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
  5.  
  6. <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
  7. <property name="environment">
  8. <props>
  9. <prop key="java.naming.provider.url">localhost:1099</prop>
  10. <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
  11. <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
  12. </props>
  13. </property>
  14. </bean>
  15.  
  16. <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  17. <property name="jndiTemplate">
  18. <ref bean="jndiTemplate"/>
  19. </property>
  20. <property name="jndiName">
  21. <value>ConnectionFactory</value>
  22. </property>
  23. </bean>
  24.  
  25.  
  26. <bean id="jmsTemplate"
  27. class="org.springframework.jms.core.JmsTemplate">
  28. <property name="connectionFactory" ref="connectionFactory"/>
  29. <property name="defaultDestination">
  30. <ref bean="sendDestination"/>
  31. </property>
  32. </bean>
  33.  
  34.  
  35. <bean id="sendDestination"
  36. class="org.springframework.jndi.JndiObjectFactoryBean">
  37. <property name="jndiTemplate">
  38. <ref bean="jndiTemplate"/>
  39. </property>
  40. <property name="jndiName">
  41. <value>queue/DummyQueue</value>
  42. </property>
  43. </bean>
  44.  
  45.  
  46.  
  47. </beans>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.