<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:nms="http://www.springframework.net/nms">

  <object id="ConnectionFactory" type="Spring.Messaging.Nms.Connections.CachingConnectionFactory, Spring.Messaging.Nms">
    <property name="SessionCacheSize" value="10" />
    <property name="TargetConnectionFactory">
      <object type="Apache.NMS.ActiveMQ.ConnectionFactory, Apache.NMS.ActiveMQ">
        <constructor-arg index="0" value="tcp://localhost:61616"/>
      </object>
    </property>
  </object>

  <object name="NmsTemplate" type="Spring.Messaging.Nms.Core.NmsTemplate, Spring.Messaging.Nms">
    <property name="ConnectionFactory" ref="ConnectionFactory"/>
    <property name="PubSubDomain" value="true"/>
    <property name="DefaultDestinationName" value="APP.STOCK.MARKETDATA"/>
    <property name="MessageConverter" ref="XmlMessageConverter"/>
  </object>


  <object name="MarketDataGateway" type="Spring.NmsQuickStart.Server.Gateways.MarketDataServiceGateway, Spring.NmsQuickStart.Server">
    <property name="NmsTemplate" ref="NmsTemplate"/>
  </object>

  <!-- Consume messages on queue APP.STOCK.REQUEST -->
  <nms:listener-container connection-factory="ConnectionFactory" concurrency="10">
    <nms:listener ref="MessageListenerAdapter" destination="APP.STOCK.REQUEST" />
  </nms:listener-container>
   
  <!-- Plain object message handler -->
  <object id="MessageListenerAdapter" type="Spring.Messaging.Nms.Listener.Adapter.MessageListenerAdapter, Spring.Messaging.Nms">
    <property name="HandlerObject" ref="StockAppHandler"/>
    <property name="DefaultHandlerMethod" value="Handle"/>
    <!-- converter from JMS object to plain object -->
    <property name="MessageConverter" ref="XmlMessageConverter"/>
  </object>


  <object name="XmlMessageConverter" type="Spring.NmsQuickStart.Common.Converters.XmlMessageConverter, Spring.NmsQuickStart.Common">
    <property name="TypeMapper" ref="TypeMapper"/>
  </object>

  <object name="TypeMapper" type="Spring.NmsQuickStart.Common.Converters.TypeMapper, Spring.NmsQuickStart.Common">
    <!-- use simple configuation style -->
    <property name="DefaultNamespace" value="Spring.NmsQuickStart.Common.Data"/>
    <property name="DefaultAssemblyName" value="Spring.NmsQuickStart.Common"/>
  </object>

</objects>
