<?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>

  <!-- EMS based implementation of technology neutral IStockServiceGateway -->
  <object name="StockServiceGateway" type="Spring.EmsQuickStart.Client.Gateways.EmsStockServiceGateway, Spring.EmsQuickStart.Client">
    <property name="EmsTemplate"  ref="EmsTemplate"/>
    <property name="DefaultReplyToQueue">
      <object type="TIBCO.EMS.Queue, TIBCO.EMS">
        <constructor-arg value="APP.STOCK.JOE"/>
      </object>
    </property>
  </object>


  <object name="EmsTemplate" type="Spring.Messaging.Ems.Core.EmsTemplate, Spring.Messaging.Ems">
    <property name="ConnectionFactory" ref="ConnectionFactory"/>
    <property name="DefaultDestinationName" value="APP.STOCK.REQUEST"/>
    <property name="MessageConverter" ref="XmlMessageConverter"/>
  </object>


  <ems:listener-container connection-factory="ConnectionFactory">
    <ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.JOE" />
    <ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.MARKETDATA" pubsub-domain="true"/>
  </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>
