<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
  ~  Licensed to the Apache Software Foundation (ASF) under one
  ~  or more contributor license agreements.  See the NOTICE file
  ~  distributed with this work for additional information
  ~  regarding copyright ownership.  The ASF licenses this file
  ~  to you under the Apache License, Version 2.0 (the
  ~  "License"); you may not use this file except in compliance
  ~  with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing,
  ~  software distributed under the License is distributed on an
  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~  KIND, either express or implied.  See the License for the
  ~  specific language governing permissions and limitations
  ~  under the License.
  -->

<document>
    <properties>
        <title>Apache Synapse - Sample 260</title>
    </properties>
    <body>
        <section name="Sample 260:Switch from FIX to AMQP">
    <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
    &lt;proxy name="FIXProxy" transports="fix"&gt;
        &lt;target&gt;
            &lt;endpoint&gt;
                &lt;address
                        uri="jms:/QpidStockQuoteService?transport.jms.ConnectionFactoryJNDIName=qpidConnectionfactory&amp;java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/sample/resources/fix/conn.properties&amp;transport.jms.ReplyDestination=replyQueue"/&gt;
            &lt;/endpoint&gt;
            &lt;inSequence&gt;
                &lt;log level="full"/&gt;
            &lt;/inSequence&gt;
            &lt;outSequence&gt;
                &lt;property name="transport.fix.ServiceName" value="FIXProxy" scope="axis2-client"/&gt;
                &lt;log level="full"/&gt;
                &lt;send/&gt;
            &lt;/outSequence&gt;
        &lt;/target&gt;
        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
            file:repository/conf/sample/resources/fix/fix-synapse.cfg
        &lt;/parameter&gt;
        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;
            file
        &lt;/parameter&gt;
    &lt;/proxy&gt;
&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
					Demonstrate the capability of switching between FIX and AMQP protocols
                </p>
            </subsection>
            <subsection name="Pre-requisites">
                <p>
                    <ul>
                        <li>
                           You will need the sample FIX blotter that comes with Quickfix/J (Banzai). Configure the blotter to establish sessions with Synapse. (refer
                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details)
                        </li>
                         <li>
                           Configure the AMQP transport for Synapse. See Configure Synapse for  <a href="setup/jms.html#amqp"> AMQP Transport setup</a> for detail
                        </li>
                        <li>
                           To get an idea about the various transport parameters being used in this sample see FIX Transport Parameters .
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
            	<p>
            	   Start the AMQP consumer, by switching to samples/axis2Client directory and running the consumer using the following command. Consumer will listen to the queue 'QpidStockQuoteService', accept the orders and reply to the queue 'replyQueue'.
            	</p>
                <div class="command">ant amqpconsumer -Dpropfile=$SYNAPSE_HOME/repository/conf/sample/resources/fix/direct.properties</div>
				<p>
				  Open up the SYNAPSE_HOME/repository/conf/sample/synapse_sample_260.xml file
				  and make sure that the transport.fix.AcceptorConfigURL property points
				  to the fix-synapse.cfg file you created. Once done you can start the
				  Synapse configuration numbered 260: i.e. synapse -sample 260. Note that
				  Synapse creates a new FIX session with Banzai at this point.
				</p>
				<p>
				  Send an order request from Banzai to Synapse. e.g. Buy DELL 1000 @ MKT.
				</p>
				<p>
				  Synapse will forward the order request by binding it to a JMS message payload and sending it to the AMQP consumer. AMQP consumer will send a execution back to Banzai.
				</p>
            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>        
    </body>
</document>