Versions Compared

Key

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

This section explains, through an example scenario, how the Message Expiration EIP can be implemented using WSO2 ESB. The following topics are covered: 

Table of Contents

...

Message Expiration EIP (Figure 1)Message Expiration Example Scenario (Figure 2)
SenderStock Quote Client 
ChannelProxyServiceProxy Service
Dead Letter ChannelFault Sequence
Intended ReceiverStock Quote Service Instance

...

  1. Download and install WSO2 ESB from http://wso2.com/products/enterprise-service-bus. For a list of prerequisites and step-by-step installation instructions, refer to Getting Started Installation Guide in the WSO2 ESB documentation.
  2. Start the sample Axis2 server. For instructions, refer to the section Setting Up the ESB Samples Setup - Starting Sample Back-End Servicesthe Axis2 server in the WSO2 ESB Documentation.

...

Start the ESB server and log into its management console UI (https://localhost:9443/carbon). In the management console, navigate  navigate to the Main Menu, click Service Bus and then Source View menu and click Source View in the Service Bus section. Next, copy and paste the following configuration, which helps you explore the example scenario, to the source view.

Anchor
step3
step3

Code Block
languagehtml/xml
linenumberstrue
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MessageExpirationProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence onError="LogAndDropMessageFault">
         <log level="full"/>
         <send/>
      </inSequence>
      <outSequence onError="fault">
         <log level="full"/>
         <send/>
      </outSequence>
      <endpoint name="TimeoutEndpoint">
         <address uri="http://localhost:9000/services/SimpleStockQuoteService">
            <timeout>
               <duration>30000</duration>
               <responseAction>fault</responseAction>
            </timeout>
         </address>
      </endpoint>
   </target>
   <description></description>
</proxy>
<sequence name="LogAndDropMessageFault">
   <log level="full">
      <property name="MESSAGE" value="Executing default &#34;fault&#34; sequence"/>
      <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
      <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
   </log>
   <drop/>
</sequence>
</definitions>

Simulating the sample scenario

  1. Send a request using the Stock Quote client to WSO2 ESB in the following manner. For information on the Stock Quote client, refer to the Sample Clients section in the WSO2 ESB documentation.
    ant stockquote -Dtrpurl=http://localhost:8280/services/MessageExpirationProxy -Dsymbol=Foo
     
    foo
  2. Notice the expected response for the request. Next, drop the Axis2 server instance and restart the ESB. The endpoint will time out and be suspended after the timeout period, causing a fault condition. 

How the implementation works

...