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

  <object id="ConnectionFactory" type="Spring.Messaging.Ems.Common.EmsConnectionFactory, Spring.Messaging.Ems">
    <constructor-arg index="0" value="tcp://localhost:7222"/>
  </object>

  <object name="EmsTemplate" type="Spring.Messaging.Ems.Core.EmsTemplate, Spring.Messaging.Ems">
    <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.EmsQuickStart.Server.Gateways.MarketDataServiceGateway, Spring.EmsQuickStart.Server">
    <property name="EmsTemplate" ref="EmsTemplate"/>
  </object>

  <!-- Consume messages on queue APP.STOCK.REQUEST -->
  <ems:listener-container connection-factory="ConnectionFactory" concurrency="10">
    <ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.REQUEST" />
  </ems:listener-container>
   
  <!-- Plain object message handler -->
  <object id="MessageListenerAdapter" type="Spring.Messaging.Ems.Listener.Adapter.MessageListenerAdapter, Spring.Messaging.Ems">
    <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.EmsQuickStart.Common.Converters.XmlMessageConverter, Spring.EmsQuickStart.Common">
    <property name="TypeMapper" ref="TypeMapper"/>
  </object>

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

</objects>
