This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation :

  • <PRODUCT_HOME>/ repository/samples/ directory that includes all Integration profile samples is changed to <EI_HOME>/ samples/service-bus/.
  • <PRODUCT_HOME>/ repository/samples/resources/ directory that includes all artifacts related to the Integration profile samples is changed to <EI_HOME>/ samples/service-bus/resources/.


This sample introduces the concept of tasks and demonstrates how a simple trigger works. Here the MessageInjector class is used, which injects a specified message to the ESB environment. You can write your own task class implementing the org.apache.synapse.startup.Task interface and implement the execute method to run the task.


For a list of prerequisites, see Prerequisites to Start the ESB Samples.

Building the sample

The XML configuration for this sample is as follows: 

<definitions xmlns="">
    <task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="CheckPrice">
        <property name="to" value="http://localhost:9000/services/SimpleStockQuoteService"/>
        <property name="soapAction" value="urn:getQuote"/>
        <property name="message">
            <m0:getQuote xmlns:m0="http://services.samples" xmlns="">
        <trigger interval="5"/>
    <sequence name="main">
            <log level="custom">
                <property name="Stock_Quote_on" expression="//ns:return/ax21:lastTradeTimestamp/child::text()"
                          xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples"/>
                <property name="For_the_organization" expression="//ns:return/ax21:name/child::text()"
                          xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples"/>
                <property name="Last_Value" expression="//ns:return/ax21:last/child::text()"
                          xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples"/>

This configuration file  synapse_sample_300.xml is available in the <EI_HOME>/samples/service-bus directory.

To build the sample

  1. Build and deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

  2.  Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.

Executing the sample

The synapse_sample_300.xml configuration adds a scheduled task to the ESB runtime so that when you start the ESB, this task will run periodically every 5 seconds. You can limit the number of times that you want the task to run by adding a count attribute with an integer as the value. If the count is not present as in this sample, the task will run forever.

Analyzing the output

You will see that the Axis2 server generates a quote every 5 seconds and that the ESB receives the stock quote response. This is because the injected message is sent to the sample Axis2 server, which sends back a response to the ESB. 

  • No labels