Author: indika
Date: Sun Aug 10 03:32:54 2008
New Revision: 20631
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20631
Log:
fix for handling binary and plain text
Added:
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js
- copied, changed from r20286,
/trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransform.js
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js
Removed:
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransform.js
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/ESBRegistry.java
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/WSO2RegistryAdapter.java
trunk/esb/java/modules/distribution/src/main/conf/synapse.properties
trunk/esb/java/repository/conf/sample/synapse_sample_350.xml
trunk/esb/java/src/site/xdoc/ESB_Samples.xml
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/ESBRegistry.java
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/ESBRegistry.java?rev=20631&r1=20630&r2=20631&view=diff
==============================================================================
---
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/ESBRegistry.java
(original)
+++
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/ESBRegistry.java
Sun Aug 10 03:32:54 2008
@@ -204,7 +204,9 @@
} finally {
try {
- result.detach();
+ if (result != null && result.getParent() != null) {
+ result.detach();
+ }
inputStream.close();
} catch (IOException e) {
log.error("Error in closing the input stream.", e);
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/WSO2RegistryAdapter.java
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/WSO2RegistryAdapter.java?rev=20631&r1=20630&r2=20631&view=diff
==============================================================================
---
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/WSO2RegistryAdapter.java
(original)
+++
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/registry/WSO2RegistryAdapter.java
Sun Aug 10 03:32:54 2008
@@ -144,7 +144,9 @@
} finally {
try {
- result.detach();
+ if (result != null && result.getParent() != null) {
+ result.detach();
+ }
inputStream.close();
} catch (IOException e) {
log.error("Error in closing the input stream.", e);
Modified: trunk/esb/java/modules/distribution/src/main/conf/synapse.properties
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/distribution/src/main/conf/synapse.properties?rev=20631&r1=20630&r2=20631&view=diff
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/conf/synapse.properties
(original)
+++ trunk/esb/java/modules/distribution/src/main/conf/synapse.properties
Sun Aug 10 03:32:54 2008
@@ -41,7 +41,7 @@
#synapse.datasources=lookupds,reportds
#synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
-#synapse.datasources.providerUrl=rmi://localhost:2199
+##synapse.datasources.providerUrl=rmi://localhost:2199
#synapse.datasources.providerPort=2199
#
#synapse.datasources.lookupds.type=BasicDataSource
Deleted:
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransform.js
URL: http://wso2.org/svn/browse/wso2/None?pathrev=20630
Copied:
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js
(from r20286,
/trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransform.js)
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js?rev=20631&r1=20286&r2=20631&view=diff
==============================================================================
---
/trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransform.js
(original)
+++
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js
Sun Aug 10 03:32:54 2008
@@ -26,16 +26,3 @@
</m:request>
</m:getQuote>);
}
-
- function transformResponse(mc) {
- var symbol = mc.getPayloadXML()..*::symbol.toString();
- var price = mc.getPayloadXML()..*::last.toString();
- mc.setPayloadXML(
- <m:CheckPriceResponse xmlns:m="http://services.samples/xsd">
- <m:Code>{symbol}</m:Code>
- <m:Price>{price}</m:Price>
- </m:CheckPriceResponse>);
- }
-
-
-
Added:
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js?pathrev=20631
==============================================================================
--- (empty file)
+++
trunk/esb/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js
Sun Aug 10 03:32:54 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights
Reserved.
+ *
+ * WSO2 Inc. 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.
+ *
+ */
+
+ function transformResponse(mc) {
+ var symbol = mc.getPayloadXML()..*::symbol.toString();
+ var price = mc.getPayloadXML()..*::last.toString();
+ mc.setPayloadXML(
+ <m:CheckPriceResponse xmlns:m="http://services.samples/xsd">
+ <m:Code>{symbol}</m:Code>
+ <m:Price>{price}</m:Price>
+ </m:CheckPriceResponse>);
+ }
+
+
+
Modified: trunk/esb/java/repository/conf/sample/synapse_sample_350.xml
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/repository/conf/sample/synapse_sample_350.xml?rev=20631&r1=20630&r2=20631&view=diff
==============================================================================
--- trunk/esb/java/repository/conf/sample/synapse_sample_350.xml
(original)
+++ trunk/esb/java/repository/conf/sample/synapse_sample_350.xml Sun Aug
10 03:32:54 2008
@@ -19,7 +19,16 @@
<!-- Introduction to the script mediator using js scripts -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
- <localEntry key="stockquoteScript"
src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/>
+
+ <registry provider="org.wso2.esb.registry.ESBRegistry">
+ <!-- the root property of the simple URL registry helps resolve a
resource URL as root + key -->
+ <parameter
name="root">file:repository/conf/sample/resources/</parameter>
+ <!-- all resources loaded from the URL registry would be cached for
this number of milli seconds -->
+ <parameter name="cachableDuration">15000</parameter>
+ </registry>
+
+ <localEntry key="stockquoteScript"
+
src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.js"/>
<in>
<!-- transform the custom quote request into a standard quote request
expected by the service -->
@@ -30,9 +39,10 @@
</endpoint>
</send>
</in>
+
<out>
<!-- transform the standard response back into the custom format the
client expects -->
- <script language="js" key="stockquoteScript"
function="transformResponse"/>
+ <script language="js" key="script/stockquoteTransformResponse.js"
function="transformResponse"/>
<send/>
</out>
</definitions>
Modified: trunk/esb/java/src/site/xdoc/ESB_Samples.xml
URL:
http://wso2.org/svn/browse/wso2/trunk/esb/java/src/site/xdoc/ESB_Samples.xml?rev=20631&r1=20630&r2=20631&view=diff
==============================================================================
--- trunk/esb/java/src/site/xdoc/ESB_Samples.xml (original)
+++ trunk/esb/java/src/site/xdoc/ESB_Samples.xml Sun Aug 10 03:32:54 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="iso-8859-1"?>
<!--
~ Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights
Reserved.
~
@@ -17,12 +17,12 @@
~ under the License.
~
-->
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="content-type" content="" />
+ <meta http-equiv="content-type"
+ content="application/xhtml+xml; charset=iso-8859-1" />
<title>WSO2 ESB - Samples Guide </title>
<link href="styles/dist-docs.css" rel="stylesheet" type="text/css"
media="all" />
@@ -75,7 +75,8 @@
and sharing a configuration between multiple instances</a> </li>
<li><a href="#Sample12">Sample 12: One way messaging / fireAndForget
through ESB</a> </li>
- <li><a href="#Sample13">Sample 13: Dual channel invocation through
synapse</a></li>
+ <li><a href="#Sample13">Sample 13: Dual channel invocation through
+ synapse</a></li>
</ul>
</li>
<li><a href="#Endpoints">Advanced mediations with endpoints</a>
@@ -115,8 +116,8 @@
proxy service without processing the security headers</a> </li>
<li><a href="#Sample154">Sample 154: Load Balancing with Proxy
Service</a> </li>
- <li><a href="#Sample155">Sample 155: Dual channel invocation
- on both client side and server side of synapse with Proxy
Services</a></li>
+ <li><a href="#Sample155">Sample 155: Dual channel invocation on both
+ client side and server side of synapse with Proxy Services</a></li>
</ul>
</li>
<li><a href="#ProxyServiceQoS">QoS addition and deduction for service
@@ -144,7 +145,8 @@
listener to mail transport sender</a> </li>
<li><a href="#Sample256">Sample 256: Proxy services with the mail
transport</a> </li>
- <li><a href="#Sample257">Sample 257: Proxy services with the FIX
transport</a></li>
+ <li><a href="#Sample257">Sample 257: Proxy services with the FIX
+ transport</a></li>
<li><a href="#Sample258">Sample 258: Switching from HTTP to FIX</a></li>
</ul>
</li>
@@ -256,14 +258,15 @@
<ol>
<li>Smart Client mode </li>
</ol>
- <pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/ </pre>
+<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/ </pre>
<ol>
<li>Using ESB as a HTTP Proxy </li>
</ol>
- <pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dprxurl=http://localhost:8280/</pre>
+<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dprxurl=http://localhost:8280/</pre>
<ol>
<li>Gateway Mode / Dumb Client </li>
</ol>
+
<p>See sample # 1 </p>
<p><strong>Prerequisites:<br />
@@ -717,8 +720,8 @@
fault back with the message 'Invalid custom quote request' as the schema
validation failed. This is because the schema used in the example expects a
slightly different message than what is created by the stock quote client.
-(i.e. expects a 'stocksymbol' element instead of 'symbol' to specify the stock
-symbol) </p>
+(i.e. expects a 'stocksymbol' element instead of 'symbol' to specify the
+stock symbol) </p>
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/</pre>
<h2><a id="Sample8">Sample 8: Introduction to static and dynamic registry
@@ -991,46 +994,40 @@
SimpleStockQuoteService replies to ESB with a HTTP 202 reply, and that ESB
in-turn replies to the client with a HTTP 202 acknowledgement </p>
- <h2>
- <a name="Sample13" id="Sample13">Sample 13: Dual channel invocation
through synapse</a>
- </h2>
- <p>
- <strong>Objective: Demonstrate dual channel messaging
- through synapse</strong>
- </p>
- <p>
- <strong>Prerequisites:</strong><br/> Start the Axis2 server
- and deploy the SimpleStockQuoteService (Refer steps above)<br/> Start
- the Synapse configuration numbered 0: i.e. synapse -sample 0
- </p>
- <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
- to a callback defined in the client.
- To test this, use 'ant
- -Dmode=dualquote...' and you will notice the dual channel invocation
- through Synapse into the sample Axis2 server instance, which reports the
response
- back to the client over a different channel:
- </p>
+<h2><a id="Sample13">Sample 13: Dual channel invocation through synapse</a>
+</h2>
+
+<p><strong>Objective: Demonstrate dual channel messaging through
+synapse</strong> </p>
+
+<p><strong>Prerequisites:</strong><br />
+Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
+above)<br />
+Start the Synapse configuration numbered 0: i.e. synapse -sample 0 </p>
+
+<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 to a callback defined in the client. To test this, use 'ant
+-Dmode=dualquote...' and you will notice the dual channel invocation through
+Synapse into the sample Axis2 server instance, which reports the response
+back to the client over a different channel: </p>
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/ -Dmode=dualquote</pre>
<pre xml:space="preserve">Response received to the callback
Standard dual channel :: Stock price = $57.16686934968289</pre>
- <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 clients 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/soap/anonService2 which implies that the
reply
- is being 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>
+
+<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 clients
+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/soap/anonService2 which implies that the reply is
+being 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>
<h1><a id="Endpoints">Advanced mediations with endpoints</a> </h1>
@@ -1493,11 +1490,11 @@
to check this in action. </p>
<pre xml:space="preserve">ant loadbalancefailover -Dmode=session</pre>
-<p>In the session mode, client continuously sends requests with three diferent
-client (session) IDs. One ID is selected among these three IDs for each
-request randomly. Then client prints the session ID with the responded server
-for each request. Client output for the first 10 requests are shown below.
-</p>
+<p>In the session mode, client continuously sends requests with three
+diferent client (session) IDs. One ID is selected among these three IDs for
+each request randomly. Then client prints the session ID with the responded
+server for each request. Client output for the first 10 requests are shown
+below. </p>
<pre xml:space="preserve">[java] Request: 1 Session number: 1 Response from
server: MyServer3
[java] Request: 2 Session number: 2 Response from server: MyServer2
[java] Request: 3 Session number: 0 Response from server: MyServer1
@@ -2091,8 +2088,8 @@
</proxy>
</definitions></pre>
-<p><strong>Objective: Switching transports and message format from SOAP to
REST/POX</strong>
-</p>
+<p><strong>Objective: Switching transports and message format from SOAP to
+REST/POX</strong> </p>
<p><strong>Prerequisites:</strong><br />
Start the Synapse configuration numbered 152: i.e. wso2-esb -sample 152 </p>
@@ -2220,7 +2217,8 @@
because the message inside ESB is signed and encrypted and can only be
forwarded to a secure service to be useful. </p>
-<h2><a id="Sample154">Sample 154: Load Balancing with Proxy Services </a> </h2>
+<h2><a id="Sample154">Sample 154: Load Balancing with Proxy Services </a>
+</h2>
<div>
<pre xml:space="preserve"> <!-- A proxy service with a loadbalace
endpoint -->
@@ -2293,10 +2291,8 @@
<p>Functionality is similar to the sample #54. </p>
- <h2>
- <a name="Sample155" id="Sample155">Sample 155: Dual channel invocation
- on both client side and serverside of synapse with Proxy Services</a>
- </h2>
+<h2><a id="Sample155">Sample 155: Dual channel invocation on both client side
+and serverside of synapse with Proxy Services</a> </h2>
<pre xml:space="preserve"><definitions
xmlns="http://ws.apache.org/ns/synapse">
<proxy name="StockQuoteProxy">
<target>
@@ -2312,41 +2308,40 @@
<publishWSDL
uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions></pre>
- <p>
- <strong>Objective: Demonstrate the dual channel invocation with Synapse
proxy services</strong>
- </p>
- <p>
- <strong>Prerequisites:</strong><br/> Start the Synapse
- configuration numbered 150: i.e. synapse -sample 155<br/> Start the
- Axis2 server and deploy the SimpleStockQuoteService if not already done
- </p>
- <p/>
- <p>
- This sample will show the action of the dual channel invocation within
client and Synapse
- as well as within synapse and the actual server. Note that if you want
to enable dual
- channel invocation you need to set the separateListener attribute to
true of the
- enableAddressing element of the endpoint.
- </p>
- <p>
- Execute the stock quote client by requesting for a stock quote on a dual
channel from the
- proxy service as follows:
- </p>
+
+<p><strong>Objective: Demonstrate the dual channel invocation with Synapse
+proxy services</strong> </p>
+
+<p><strong>Prerequisites:</strong><br />
+Start the Synapse configuration numbered 150: i.e. synapse -sample 155<br />
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+done </p>
+
+<p></p>
+
+<p>This sample will show the action of the dual channel invocation within
+client and Synapse as well as within synapse and the actual server. Note that
+if you want to enable dual channel invocation you need to set the
+separateListener attribute to true of the enableAddressing element of the
+endpoint. </p>
+
+<p>Execute the stock quote client by requesting for a stock quote on a dual
+channel from the proxy service as follows: </p>
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:8280/soap/StockQuoteProxy -Dmode=dualquote</pre>
- <p>
- In the above example, the request received is forwarded to the sample
service
- hosted on Axis2 and the endpoint specifies to enable addressing and do
the invocation
- over a dual channel. If you observe this message flow by using a TCPmon,
you could see that
- on the channel you send the request to synapse the response has been
written as an
- HTTP 202 Accepted, where as the real response from synapse will come
over a different channel
- which cannot be obsesrved unless you use tcpdump to dump all the TCP
level messages.
- </p>
- <p>
- At the same time you can observe the behaviour of the invocation between
synapse and
- the actual Axis2 service, where you can see a 202 Accepted message being
delivered to synapse
- as the response to the request. The actual response will be delivered to
synapse over a
- different channel.
- </p>
-
+
+<p>In the above example, the request received is forwarded to the sample
+service hosted on Axis2 and the endpoint specifies to enable addressing and
+do the invocation over a dual channel. If you observe this message flow by
+using a TCPmon, you could see that on the channel you send the request to
+synapse the response has been written as an HTTP 202 Accepted, where as the
+real response from synapse will come over a different channel which cannot be
+obsesrved unless you use tcpdump to dump all the TCP level messages. </p>
+
+<p>At the same time you can observe the behaviour of the invocation between
+synapse and the actual Axis2 service, where you can see a 202 Accepted
+message being delivered to synapse as the response to the request. The actual
+response will be delivered to synapse over a different channel. </p>
+
<h1><a id="ProxyServiceQoS">QoS addition and deduction for service mediation
(proxy) samples</a> </h1>
@@ -3067,10 +3062,8 @@
<p>After a few seconds (e.g. 30s), you should receive a POX response in your
email account with the stock quote reply. </p>
- <h2>
- <a id="Sample257">Sample 257: Proxy services with the
- FIX transport </a>
- </h2>
+<h2><a id="Sample257">Sample 257: Proxy services with the FIX transport </a>
+</h2>
<pre xml:space="preserve"><!-- Using the FIX transport -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="FIXProxy" transports="fix">
@@ -3094,52 +3087,44 @@
</target>
</proxy>
</definitions> </pre>
- <p>
- <strong>Objective: Demonstrate the usage of the FIX (Financial
Information eXchange) transport with proxy services</strong>
- </p>
- <p>
- <strong>Prerequisites:</strong><br/>
- You will need the two sample FIX applications that come with Quickfix/J
- (Banzai and Executor). Configure the two applications to establish
- sessions with Synapse. See <a
href="ESB_Samples_Setup.html#fixsamplesconfig">
- Configuring Sample FIX Applications</a>
- </p>
- <p>
- Start Banzai and Executor
- </p>
- <p>
- Enable FIX transport in the Synapse axis2.xml. See <a
- href="ESB_Samples_Setup.html#fixtransport">Setting up FIX transport
- </a>
- </p>
- <p>
- Configure Synapse for FIX samples. See <a
href="ESB_Samples_Setup.html#fixsamples">
- Configuring Synapse for FIX Samples</a>
- </p>
- <p>
- Open up the SYNAPSE_HOME/repository/conf/sample/synapse_sample_257.xml
file
- and make sure that transport.fix.AcceptorConfigURL property points to the
- fix-synapse.cfg file you created. Also make sure that transport.fix.
- InitiatorConfigURL property points to the synapse-sender.cfg file you
- created. Once done you can start the Synapse configuration numbered 257:
- i.e. synapse -sample 257. Note that Synapse creates a new FIX session
with
- Banzai at this point.
- </p>
- <p>
- Send an order request from Banzai to Synapse.
- </p>
- <p>
- Synapse will create a session with Executor and forward the order
request. The
- responses coming from the Executor will be sent back to Banzai. It will
take a
- couple of seconds for the responses to arrive for the first request
since Synapse
- has to establish a session with the Executor. But all the subsequent
messages
- will pass through almost instantaneously.
- </p>
- <h2>
- <a id="Sample258">Sample 258: Switching from HTTP to FIX </a>
- </h2>
-<pre xml:space="preserve">
-<definitions xmlns="http://ws.apache.org/ns/synapse">
+
+<p><strong>Objective: Demonstrate the usage of the FIX (Financial Information
+eXchange) transport with proxy services</strong> </p>
+
+<p><strong>Prerequisites:</strong><br />
+You will need the two sample FIX applications that come with Quickfix/J
+(Banzai and Executor). Configure the two applications to establish sessions
+with Synapse. See <a
+href="ESB_Samples_Setup.html#fixsamplesconfig">Configuring Sample FIX
+Applications</a> </p>
+
+<p>Start Banzai and Executor </p>
+
+<p>Enable FIX transport in the Synapse axis2.xml. See <a
+href="ESB_Samples_Setup.html#fixtransport">Setting up FIX transport </a> </p>
+
+<p>Configure Synapse for FIX samples. See <a
+href="ESB_Samples_Setup.html#fixsamples">Configuring Synapse for FIX
+Samples</a> </p>
+
+<p>Open up the SYNAPSE_HOME/repository/conf/sample/synapse_sample_257.xml
+file and make sure that transport.fix.AcceptorConfigURL property points to
+the fix-synapse.cfg file you created. Also make sure that transport.fix.
+InitiatorConfigURL property points to the synapse-sender.cfg file you
+created. Once done you can start the Synapse configuration numbered 257: i.e.
+synapse -sample 257. Note that Synapse creates a new FIX session with Banzai
+at this point. </p>
+
+<p>Send an order request from Banzai to Synapse. </p>
+
+<p>Synapse will create a session with Executor and forward the order request.
+The responses coming from the Executor will be sent back to Banzai. It will
+take a couple of seconds for the responses to arrive for the first request
+since Synapse has to establish a session with the Executor. But all the
+subsequent messages will pass through almost instantaneously. </p>
+
+<h2><a id="Sample258">Sample 258: Switching from HTTP to FIX </a> </h2>
+<pre xml:space="preserve"><definitions
xmlns="http://ws.apache.org/ns/synapse">
<proxy name="FIXProxy">
<parameter
name="transport.fix.InitiatorConfigURL">file:/home/synapse_user/fix-config/synapse-sender.cfg</parameter>
@@ -3161,46 +3146,39 @@
</target>
</proxy>
</definitions> </pre>
- <p>
- <strong>Objective: Demonstrate switching from HTTP to FIX</strong>
- </p>
- <p>
- <strong>Prerequisites:</strong><br/>
- You will need the Executor sample application that comes with
Quickfix/J.
- Configure Executor to establish a session with Synapse. See <a href=
- "ESB_Samples_Setup.html#fixsamplesconfig">Configuring Sample FIX
- Applications</a>
- </p>
- <p>
- Start Executor.
- </p>
- <p>
- Enable FIX transport sender in the Synapse axis2.xml. See <a
- href="ESB_Samples_Setup.html#fixtransport">Setting up FIX transport
- </a>
- </p>
- <p>
- Configure Synapse for FIX samples. See <a
href="ESB_Samples_Setup.html#fixsamples">
- Configuring Synapse for FIX Samples</a>. There is no need to create the
fix-synapse.cfg
- file for this sample. Having only the synapse-sender.cfg file is
sufficient.
- </p>
- <p>
- Go to the SYNAPSE_HOME/repository/conf/sample/synapse_sample_258.xml
- file and make sure that transport.fix.InitiatorConfigURL property
- points to the synapse-sender.cfg file you created. Once done you can
- start the Synapse configuration numbered 258: i.e. synapse -sample 258
- </p>
- <p>
- Invoke the FIX Client as follows. This command sends a FIX message
- embedded in a SOAP message over HTTP.
- </p>
- <pre>ant fixclient -Dsymbol=IBM -Dqty=5 -Dmode=buy
-Daddurl=http://localhost:8280/soap/FIXProxy</pre>
- <p>
- Synapse will create a session with Executor and forward the order
request. The
- first response coming from the Executor will be sent back over HTTP.
Executor
- generally sends two responses for each incoming order request. But since
the
- response has to be forwarded over HTTP only one can be sent back to the
client.
- </p>
+
+<p><strong>Objective: Demonstrate switching from HTTP to FIX</strong> </p>
+
+<p><strong>Prerequisites:</strong><br />
+You will need the Executor sample application that comes with Quickfix/J.
+Configure Executor to establish a session with Synapse. See <a
+href="ESB_Samples_Setup.html#fixsamplesconfig">Configuring Sample FIX
+Applications</a> </p>
+
+<p>Start Executor. </p>
+
+<p>Enable FIX transport sender in the Synapse axis2.xml. See <a
+href="ESB_Samples_Setup.html#fixtransport">Setting up FIX transport </a> </p>
+
+<p>Configure Synapse for FIX samples. See <a
+href="ESB_Samples_Setup.html#fixsamples">Configuring Synapse for FIX
+Samples</a>. There is no need to create the fix-synapse.cfg file for this
+sample. Having only the synapse-sender.cfg file is sufficient. </p>
+
+<p>Go to the SYNAPSE_HOME/repository/conf/sample/synapse_sample_258.xml file
+and make sure that transport.fix.InitiatorConfigURL property points to the
+synapse-sender.cfg file you created. Once done you can start the Synapse
+configuration numbered 258: i.e. synapse -sample 258 </p>
+
+<p>Invoke the FIX Client as follows. This command sends a FIX message
+embedded in a SOAP message over HTTP. </p>
+<pre>ant fixclient -Dsymbol=IBM -Dqty=5 -Dmode=buy
-Daddurl=http://localhost:8280/soap/FIXProxy</pre>
+
+<p>Synapse will create a session with Executor and forward the order request.
+The first response coming from the Executor will be sent back over HTTP.
+Executor generally sends two responses for each incoming order request. But
+since the response has to be forwarded over HTTP only one can be sent back to
+the client. </p>
<h1><a id="Task">Introduction to ESB tasks</a> </h1>
@@ -3241,11 +3219,11 @@
You will need access to build the SimpleStockQuoteService as mentioned in the
above and start the sample axis2 server before staring ESB. </p>
-<p>When ever ESB gets started with this configuration (i.e. ./synapse.sh
-sample 300), this task will run
-periodically in 5 second intervals. You could limit the number of times that
-you want to run this task by adding a count attribute with an integer as the
-value, if the count is not present as in this sample this task will run
-forever. </p>
+<p>When ever ESB gets started with this configuration (i.e. ./synapse.sh
+-sample 300), this task will run periodically in 5 second intervals. You
+could limit the number of times that you want to run this task by adding a
+count attribute with an integer as the value, if the count is not present as
+in this sample this task will run forever. </p>
<p>One can write his own task class implementing the
org.apache.synapse.startup.Task interface and implementing the execute method
@@ -3267,8 +3245,18 @@
<h2><a id="Sample350">Sample 350: Introduction to the script mediator using
js scripts</a> </h2>
-<pre xml:space="preserve"><definitions
xmlns="http://ws.apache.org/ns/synapse">
- <localEntry key="stockquoteScript"
src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/>
+<pre xml:space="preserve"><!-- Introduction to the script mediator using js
scripts -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <registry provider="org.wso2.esb.registry.ESBRegistry">
+ <!-- the root property of the simple URL registry helps resolve a
resource URL as root + key -->
+ <parameter
name="root">file:repository/conf/sample/resources/</parameter>
+ <!-- all resources loaded from the URL registry would be cached for
this number of milli seconds -->
+ <parameter name="cachableDuration">15000</parameter>
+ </registry>
+
+ <localEntry key="stockquoteScript"
+
src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.js"/>
<in>
<!-- transform the custom quote request into a standard quote
request expected by the service -->
@@ -3279,12 +3267,14 @@
</endpoint>
</send>
</in>
+
<out>
<!-- transform the standard response back into the custom format
the client expects -->
- <script language="js" key="stockquoteScript"
function="transformResponse"/>
+ <script language="js" key="script/stockquoteTransformResponse.js"
function="transformResponse"/>
<send/>
</out>
-</definitions> </pre>
+</definitions>
+ </pre>
<p></p>
<pre xml:space="preserve"><x><![CDATA[
@@ -3658,8 +3648,7 @@
<p></p>
-<p><strong>Objective:Introduction to the dblookup
-mediator</strong> </p>
+<p><strong>Objective:Introduction to the dblookup mediator</strong> </p>
<p><strong>Prerequisites:</strong> Setting up Derby database as explained
above. </p>
@@ -3755,8 +3744,7 @@
</definitions></pre>
<div>
-<p><strong>Objective: Introduction to the dbreport
-mediator</strong> </p>
+<p><strong>Objective: Introduction to the dbreport mediator</strong> </p>
<p><strong>Prerequisites:</strong> Setting up Derby database as above. </p>
@@ -4053,8 +4041,7 @@
<p></p>
<p>Then the console output</p>
-<pre>
- INFO LogMediator text = ** Looking up from the Database **
+<pre> INFO LogMediator text = ** Looking up from the Database **
...
INFO LogMediator text = Company ID - c1
...
@@ -4118,8 +4105,8 @@
</sequence>
</definitions></pre>
-<p><strong>Objective: </strong>Demonstrate the use of throttle mediator for
concurrency
-throttling></p>
+<p><strong>Objective: </strong>Demonstrate the use of throttle mediator for
+concurrency throttling></p>
<p><strong>Prerequisites:</strong> </p>
@@ -4134,14 +4121,15 @@
<p>Above configuration specifies a throttle mediator inside the in mediator.
Therefore, all request messages directed to the main sequence will be
subjected to throttling. Throttle mediator has 'policy', 'onAccept' and
-'onReject' tags at top level. The 'policy' tag specifies the throttling policy
for
-throttling messages. This sample policy only contains a component called
-"MaximumConcurrentAccess" .This indicates the maximum number of concurrent
-requests that can pass through Synapse on a single
-unit of time. To test concurrency throttling, it is required to send
-concurrent requests to Synapse. If Synapse with above configuration, receives
-20 requests concurrently from clients, then approximately half of those will
-succeed while the others being throttled. The client command to try this is as
follows.</p>
+'onReject' tags at top level. The 'policy' tag specifies the throttling
+policy for throttling messages. This sample policy only contains a component
+called "MaximumConcurrentAccess" .This indicates the maximum number of
+concurrent requests that can pass through Synapse on a single unit of time.
+To test concurrency throttling, it is required to send concurrent requests to
+Synapse. If Synapse with above configuration, receives 20 requests
+concurrently from clients, then approximately half of those will succeed
+while the others being throttled. The client command to try this is as
+follows.</p>
<pre xml:space="preserve">ant stockquote -Dsymbol=IBM -Dmode=quote
-Daddurl=http://localhost:8280/</pre>
<p></p>
@@ -4344,11 +4332,11 @@
<p></p>
-<p>Throttle policy is loaded from the "throttle_policy. xml"
-.That policy contains merging policy from sample 370 and 371. To check the
-functionality , it is need to run load test.The all enabled request from the
-concurrency throttling will be controlled by the access rate base throttling
-according to the policy. </p>
+<p>Throttle policy is loaded from the "throttle_policy. xml" .That policy
+contains merging policy from sample 370 and 371. To check the functionality ,
+it is need to run load test.The all enabled request from the concurrency
+throttling will be controlled by the access rate base throttling according to
+the policy. </p>
<p>Run the client as follows </p>
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:8280/soap/StockQuoteProxy</pre>
@@ -4736,9 +4724,9 @@
</out>
</definitions></pre>
-<p><strong>Objective: Demonstrate the use of Cache mediator in order to
-cache the response and use that cached response as the response for an
-identical xml request</strong></p>
+<p><strong>Objective: Demonstrate the use of Cache mediator in order to cache
+the response and use that cached response as the response for an identical
+xml request</strong></p>
<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in
sample Axis2 server and start it on port 9000. </p>
_______________________________________________
Esb-java-dev mailing list
[email protected]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-dev