Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagehtml/xml
linenumberstrue
<definitions xmlns="http://ws.apache.org/ns/synapse">
	<!-- Proxy for normal message flow -->
    <taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/>
	<proxy name="ServiceProxy" transports="https http" startOnLoad="true" trace="disable">
		<target inSequence="sendSeq"/>
	</proxy>
	
	<!-- Normal flow of the messages -->
	<sequence name="sendSeq">
		<send receive="receiveSeq">
			<endpoint>
				<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
			</endpoint>
		</send>
	</sequence>

	<!-- Fault sequence handles failures -->
   <sequence name="fault">
      <log level="full">
         <property name="MESSAGE" value="Executing default 'fault' sequence"/>
         <property xmlns:ns="http://org.apache.synapse/xsd"
                   name="ERROR_CODE"
                   expression="get-property('ERROR_CODE')"/>
         <property xmlns:ns="http://org.apache.synapse/xsd"
                   name="ERROR_MESSAGE"
                   expression="get-property('ERROR_MESSAGE')"/>
      </log>

		<!-- Filter the failed Test Messages -->
		<filter xmlns:ns="http://org.apache.synapse/xsd"
              xmlns:m0="http://services.samples"
              source="//m0:getQuote/m0:request/m0:symbol"
              regex="TEST">
			<then>
				<log>
					<property name="FAILURE" value="*** Test Message Failed ***"/>
					<property name="FAILED SERVICE" value="*** localhost:9000/services/SimpleStockQuoteService ***"/>
				</log>
			</then>
			<else/>
		</filter>
		<drop/>
	</sequence>

	<!-- Receiving messages from service -->
	<sequence name="receiveSeq">
		<log/>
		<!-- Filter the Test Messages -->
		<filter xmlns:ax21="http://services.samples/xsd"
				xmlns:ns="http://org.apache.synapse/xsd"
				source="//ax21:symbol"
				regex="TEST">
		<then>
			<log>
               <property name="TEST PASSED" value="*** Test Message Passed ***"/>
               <property name="TESTED SERVICE" value="*** localhost:9000/services/SimpleStockQuoteService ***"/>
            </log>
            <drop/>
         </then>
         <else>
            <send/>
         </else>
		</filter>
	</sequence>
	
<!-- main sequence used as the test Message injector -->
	<sequence name="main">
      <in>
         <sequence key="sendSeq"/>
      </in>
      <out>
         <send/>
      </out>      
   </sequence>

	<!-- Task Scheduler act as Test data generator -->
	<task name="Testing"
		class="org.apache.synapse.startup.tasks.MessageInjector"
		group="synapse.simple.quartz">
		
		<!-- Interval between generating test messages, Cron Expression are also allowed to use -->      
		<trigger interval="25"/>
      
		<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
			<m0:getQuote xmlns:m0="http://services.samples">
            <m0:request>
               <m0:symbol>TEST</m0:symbol>
            </m0:request>
			</m0:getQuote>
		</property>
		<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="soapAction"
                value="urn:getQuote"/>
		<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="to"
                value="http://localhost:9000/services/SimpleStockQuoteService"/>
	</task>
</definitions>

...