You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ka...@apache.org on 2011/12/23 05:40:15 UTC

svn commit: r1222556 - in /synapse/branches/2.1: repository/conf/sample/synapse_sample_750.xml src/site/xdoc/userguide/faq.xml src/site/xdoc/userguide/samples.xml src/site/xdoc/userguide/samples/sample750.xml

Author: kasun
Date: Fri Dec 23 04:40:15 2011
New Revision: 1222556

URL: http://svn.apache.org/viewvc?rev=1222556&view=rev
Log:
Adding samples and faqs

Added:
    synapse/branches/2.1/repository/conf/sample/synapse_sample_750.xml
    synapse/branches/2.1/src/site/xdoc/userguide/samples/sample750.xml
Modified:
    synapse/branches/2.1/src/site/xdoc/userguide/faq.xml
    synapse/branches/2.1/src/site/xdoc/userguide/samples.xml

Added: synapse/branches/2.1/repository/conf/sample/synapse_sample_750.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/repository/conf/sample/synapse_sample_750.xml?rev=1222556&view=auto
==============================================================================
--- synapse/branches/2.1/repository/conf/sample/synapse_sample_750.xml (added)
+++ synapse/branches/2.1/repository/conf/sample/synapse_sample_750.xml Fri Dec 23 04:40:15 2011
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+~  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.
+-->
+
+<!-- Introduction to Synapse Scheduled Message Forwarding Processor -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+
+    <proxy name="StockQuoteProxy">
+        <target>
+            <inSequence>
+                <!--use sequence template to transform incoming request-->
+                <call-template target="xslt_func">
+                    <with-param name="xslt_key" value="xslt-key-req"/>
+                </call-template>
+                <send>
+                    <endpoint>
+                        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                    </endpoint>
+                </send>
+            </inSequence>
+
+            <outSequence>
+                <!--use sequence template to transform incoming response-->
+                <call-template target="xslt_func">
+                    <with-param name="xslt_key" value="xslt-key-back"/>
+                </call-template>
+                <send/>
+            </outSequence>
+        </target>
+    </proxy>
+
+    <!--this sequence template will transform requests with the given xslt local entry key And will log
+    the message before and after. Takes Iterate local entry key as an argument-->
+    <template xmlns="http://ws.apache.org/ns/synapse" name="xslt_func">
+        <parameter name="xslt_key"/>
+        <sequence>
+            <log level="full">
+                <property name="BEFORE_TRANSFORM" value="true"/>
+            </log>
+            <xslt key="{$func:xslt_key}"/>
+            <log level="full">
+                <property name="AFTER_TRANSFORM" value="true"/>
+            </log>
+        </sequence>
+    </template>
+
+    <localEntry key="xslt-key-req"
+                src="file:repository/samples/resources/transform/transform.xslt"/>
+    <localEntry key="xslt-key-back"
+                src="file:repository/samples/resources/transform/transform_back.xslt"/>
+</definitions>
\ No newline at end of file

Modified: synapse/branches/2.1/src/site/xdoc/userguide/faq.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/faq.xml?rev=1222556&r1=1222555&r2=1222556&view=diff
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/faq.xml (original)
+++ synapse/branches/2.1/src/site/xdoc/userguide/faq.xml Fri Dec 23 04:40:15 2011
@@ -28,13 +28,13 @@
             </p>
         </section>
         <section name="General(GeneralApache Synapse questions - Non technical)">
-
             <ol>
                 <li>
                     What is Apache Synapse?
                     <ul>
                         <li>
-                            Apache Synapse is a lightweight and high-performance Enterprise Service Bus (ESB).
+                            Apache Synapse is a lightweight and high-performance Enterprise Service
+                            Bus (ESB).
                         </li>
                     </ul>
                 </li>
@@ -44,19 +44,246 @@
                     What makes Apache Synapse unique?
                     <ul>
                         <li>
-                            Apache Synapse is fast and able to handle thousands of concurrent connections
+                            Apache Synapse is fast and able to handle thousands of concurrent
+                            connections
                             with constant memory usage. It comes with a rich set of mediators to
-                            support almost any integration scenario out of the box. It is also easily
+                            support almost any integration scenario out of the box. It is also
+                            easily
                             extensible and highly customizable.
                         </li>
                     </ul>
                 </li>
                 <p/>
-
+                <li>
+                    What is the license?
+                    <ul>
+                        <li>
+                            Apache Synapse comes with Apache 2.0 licence.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
             </ol>
         </section>
 
+        <section name="Mediation(Questions related to sequences, endpoints, proxies etc)">
+            <ol>
+                <li>
+                    What is a proxy service?
+                    <ul>
+                        <li>
+                            A proxy service is a virtual service hosted on the ESB. It can accept
+                            requests from service clients, just like a real Web Service. A proxy
+                            service can process requests and forward them to an actual Web Service
+                            (back end service) to be further processed. The responses coming back
+                            from
+                            the back end service can be routed back to the original client. Proxy
+                            services are mostly used to expose an existing service over a different
+                            transport, format or QoS configuration.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+
+                <li>
+                    What is a mediator?
+                    <ul>
+                        <li>
+                            A mediator is the basic message processing unit in the ESB. A mediator
+                            can take a message, carry out some predefined actions on it and output
+                            the modified message. Apache Synapse ships with a range of mediators capable
+                            of carrying out various tasks on input messages.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is a sequence?
+                    <ul>
+                        <li>
+                            A sequence is an ordered list of mediators (a mediator chain). When a
+                            sequence is given a message, it will go through all the mediators in the
+                            sequence. A sequence can also handover messages to other sequences.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is an Endpoint?
+                    <ul>
+                        <li>
+                            A logical representation of an actual endpoint or a group of endpoints
+                            (i.e. Load Balancing and Fail Over).
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What are Local Entries?
+                    <ul>
+                        <li>
+                            Local entries can be used to hold various configuration elements
+                            required by sequences and proxy services. Usually they are used to hold
+                            WSDLs, XSDs, XSLT files etc. A local entry can contain XML content as
+                            well
+                            as plain text content. A local entry can be configured to load content
+                            from a remote file too.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+
+                <li>
+                    What is a Message Mediation?
+                    <ul>
+                        <li>
+                            Managing and transforming the messages flowing between the client and a
+                            service in an enterprise.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+
+                <li>
+                    What is Message Mediation?
+                    <ul>
+                        <li>
+                            Mediating messages coming into a specific service by specifying the
+                            target URI as a Synapse mediation service.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is Service Mediation?
+                    <ul>
+                        <li>
+                            Mediating messages coming into a specific service by specifying the
+                            target URI as a Synapse mediation service.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is a Message Store?
+                    <ul>
+                        <li>
+                            Message Store is the storage for ESB messages. It can be an in-memory
+                            store
+                            or can be JMS store with an external Message Broker. You can always plug
+                            your
+                            own message store implementations as well.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is a Message Processor?
+                    <ul>
+                        <li>
+                            Message processor can be used to implement different messaging and
+                            integration patters along with Message stores. Message processors will
+                            consume
+                            the messages in message stores and do the processing of them.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is a Template?
+                    <ul>
+                        <li>
+                            ESB Templates try to minimize this redundancy by creating prototypes
+                            that
+                            users can re-use and utilize as and when needed. This is very much
+                            analogous
+                            to classes and instances of classes where-as, a template is a class that
+                            can be used to wield instance objects such as templates and endpoints.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is the REST Api?
+                    <ul>
+                        <li>
+                            REST Api can be used to mediate HTTP POST, GET, PUT and DELETE request
+                            through Synapse and to integrate various RESTful services.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    Can Endpoint perform error handling?
+                    <ul>
+                        <li>
+                            Yes. Endpoints can do error handling. User can configure the behavior
+                            of an endpoints when it faced to a erroneous situation.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+            </ol>
+        </section>
+        <section name="Transports(Transport related questions)">
+            <ol>
+                <li>
+                    What are the transports supported by the Apache Synapse?
+                    <ul>
+                        <li>
+                            HTTP, HTTPS, VFS based file transport, FIX, Hessian, HL7,UDP, JMS, Mail,
+                            TCP, XMPP
+                        </li>
+                    </ul>
+                </li>
+                <p/>
 
+                <li>
+                    Do I need an external JMS broker for the JMS transport?
+                    <ul>
+                        <li>
+                            Yes, Apache Synapse requires an external JMS broker like Apache ActiveMQ
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    Does Apache Synapse support two way JMS scenario (request/response) ?
+                    <ul>
+                        <li>
+                            Yes, you can refer sample 264 which demonstrates exactly the JMS
+                            request/response scenario.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is the NHTTP transport?
+                    <ul>
+                        <li>
+                           This is the default HTTP transport used by Apache Synapse. NHTTP stands for
+                            non-blocking HTTP. NHTTP transport uses the Java Non-blocking I/O API.
+                            This allows the NHTTP transport to scale into handling hundreds of connections
+                            without blocking the threads. The server worker threads used by the NHTTP
+                            transport do not get blocked on I/O until the Synapse receives responses
+                            for the already forwarded requests. Therefore Apache Synapse can accept
+                            more concurrent connections and requests than most HTTP server products.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+                <li>
+                    What is the underlying HTTP library used by the NHTTP transport?
+                    <ul>
+                        <li>
+                           NHTTP transport uses the Apache Http Core NIO library underneath. This
+                           library provides low level I/O handling and HTTP level detail handling.
+                        </li>
+                    </ul>
+                </li>
+                <p/>
+            </ol>
+        </section>
 
     </body>
 </document>

Modified: synapse/branches/2.1/src/site/xdoc/userguide/samples.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples.xml?rev=1222556&r1=1222555&r2=1222556&view=diff
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples.xml (original)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples.xml Fri Dec 23 04:40:15 2011
@@ -244,6 +244,13 @@
                     </ul>
                 </p>
             </subsection>
+            <subsection name="Templates">
+                <p>
+                    <ul>
+                        <li><a href="samples/sample750.html">Sample 750: Introduction to Synapse Templates</a></li>
+                    </ul>
+                </p>
+            </subsection>
             <subsection name="REST API">
                 <p>
                     <ul>

Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample750.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample750.xml?rev=1222556&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample750.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample750.xml Fri Dec 23 04:40:15 2011
@@ -0,0 +1,109 @@
+<?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 750</title>
+    </properties>
+    <body>
+        <section name="Sample 750: Stereotyping XSLT Transformations with Templates">
+            <div class="xmlConf">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+    &lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
+
+        &lt;proxy name=&quot;StockQuoteProxy&quot;&gt;
+            &lt;target&gt;
+            &lt;inSequence&gt;
+            &lt;!--use sequence template to trasnform incoming request--&gt;
+            &lt;call-template target=&quot;xslt_func&quot;&gt;
+                            &lt;with-param name=&quot;xslt_key&quot; value=&quot;xslt-key-req&quot;/&gt;
+                    &lt;/call-template&gt;
+            &lt;send&gt;
+                &lt;endpoint&gt;
+                                  &lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;
+                            &lt;/endpoint&gt;
+                    &lt;/send&gt;
+                &lt;/inSequence&gt;
+
+                &lt;outSequence&gt;
+            &lt;!--use sequence template to trasnform incoming response--&gt;
+            &lt;call-template target=&quot;xslt_func&quot;&gt;
+                            &lt;with-param name=&quot;xslt_key&quot; value=&quot;xslt-key-back&quot;/&gt;
+                    &lt;/call-template&gt;
+                    &lt;send/&gt;
+                &lt;/outSequence&gt;
+            &lt;/target&gt;
+        &lt;/proxy&gt;
+
+        &lt;!--this sequence template will trasnform requests with the given xslt local entry key And will log
+        the message before and after. Takes Iterate local entry key as an argument--&gt;
+        &lt;template xmlns=&quot;http://ws.apache.org/ns/synapse&quot; name=&quot;xslt_func&quot;&gt;
+            &lt;parameter name=&quot;xslt_key&quot;/&gt;
+            &lt;sequence&gt;
+                    &lt;log level=&quot;full&quot;&gt;
+                &lt;property name=&quot;BEFORE_TRANSFORM&quot; value=&quot;true&quot; /&gt;
+            &lt;/log&gt;
+                 &lt;xslt key=&quot;{$func:xslt_key}&quot;/&gt;
+            &lt;log level=&quot;full&quot;&gt;
+                &lt;property name=&quot;AFTER_TRANSFORM&quot; value=&quot;true&quot; /&gt;
+            &lt;/log&gt;
+            &lt;/sequence&gt;
+        &lt;/template&gt;
+
+        &lt;localEntry key=&quot;xslt-key-req&quot; src=&quot;file:repository/samples/resources/transform/transform.xslt&quot;/&gt;
+        &lt;localEntry key=&quot;xslt-key-back&quot; src=&quot;file:repository/samples/resources/transform/transform_back.xslt&quot;/&gt;
+    &lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Introduction to Apache Synapse Sequence Templates
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 750 (repository/conf/sample/synapse_sample_750.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 750<br/>
+                                Windows: synapse.bat -sample 750
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    First execute the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy  -Dmode=customquote</div>
+                <p>
+                    Sequence Template can act a reusable function. Here the proxy service reuses
+                    template xslt_func which will transform requests with the given xslt local entry
+                    key And will log the message before and after. It takes xslt transformation corresponding
+                    to local entry key as an argument (for insequence this key is xslt-key-req and out sequence it is xslt-key-back).
+                    We use call-template mediator for passing the xslt key parameter to a sequence template.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file