<?xml version="1.0" encoding="UTF-8"?>

<!-- START SNIPPET: spring -->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

  <!-- JMS ConnectionFactory to use -->
  <bean id="jmsFactory" class="org.codehaus.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
      <value>vm://localhost</value>
    </property>
  </bean>

  <!-- Spring JMS Template -->
  <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
      <!-- lets wrap in a pool to avoid creating a connection per send -->
      <bean class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
          <ref local="jmsFactory"/>
        </property>
      </bean>
    </property>
    <property name="pubSubDomain">
      <value>false</value>
    </property>
  </bean>

  <!-- a sample POJO which uses a Spring JmsTemplate -->
  <bean id="producer" class="org.codehaus.activemq.spring.SpringProducer">
    <property name="template">
      <ref bean="myJmsTemplate"></ref>
    </property>

    <property name="subject">
      <value>org.codehaus.activemq.spring.Test</value>
    </property>

    <property name="messageCount">
      <value>10</value>
    </property>
  </bean>


  <!-- a sample POJO consumer -->
  <bean id="consumer" class="org.codehaus.activemq.spring.SpringConsumer">
    <property name="template">
      <ref bean="myJmsTemplate"></ref>
    </property>

    <property name="destination">
      <bean class="org.codehaus.activemq.message.ActiveMQQueue" autowire="constructor">
        <constructor-arg>
          <value>org.codehaus.activemq.spring.Test</value>
        </constructor-arg>
      </bean>
    </property>
  </bean>

</beans>

<!-- END SNIPPET: spring -->
