<?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 13</title>
    </properties>
    <body>
        <section name="Sample 13: Dual Channel Invocations Through Synapse">
            <div class="xmlConf">&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;

    &lt;sequence name="main"&gt;
        &lt;!-- log all attributes of messages passing through --&gt;
        &lt;log level=&quot;full&quot;/&gt;

        &lt;!-- Send the message to implicit destination --&gt;
        &lt;send/&gt;
    &lt;sequence/&gt;

&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
                    Demonstrate the ability to perform dual channel invocations through
                    Synapse (asynchronous notification).
                </p>
            </subsection>
            <subsection name="Pre-requisites">
                <p>
                    <ul>
                        <li>
                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
                        </li>
                        <li>
                            This sample makes use of the configuration used in <a href="sample0.html">sample 0</a>.
                            So start Synapse using the configuration numbered 0 (repository/conf/sample/synapse_sample_0.xml)
                            <div class="command">
                                Unix/Linux: sh synapse.sh -sample 0<br/>
                                Windows: synapse.bat -sample 0
                            </div>
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
                <p>
                    Execute the client as follows.
                </p>
                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
                <p>
                    This example invokes the same 'getQuote' operation on the SimpleStockQuoteService
                    using the custom client which uses the Axis2 ServiceClient API with useSeparateListener
                    set to 'true', so that the response is coming through a different channel than
                    the one which is used to send the request. Note the following log thrown out
                    by the sample client.
                </p>
                <div class="consoleOutput">Response received to the callback
Standard dual channel :: Stock price = $57.16686934968289</div>
                <p>
                    If you send your client request through TCPmon, you will notice that Synapse replies
                    to the client with a HTTP 202 acknowledgment when you send the request and the
                    communication between Synapse and the server happens on a single channel and then
                    you get the response back from Synapse to the client callback in a different channel
                    (which cannot be observed through TCPmon).
                </p>
                <p>
                    Also you could see the wsa:Reply-To header being something like
                    http://localhost:8200/axis2/services/anonService2 which implies that the reply
                    is gpoing on a different channel listening on the port 8200. Please note that it
                    is required to engage addressing when using the dual channel invocation because
                    it requires the wsa:Reply-To header.
                </p>                
            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>
    </body>
</document>