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 |
---|
...
Simulating the sample scenario
- 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
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
Let's investigate the elements of the ESB configuration in detail. The line numbers below are mapped with the ESB configuration shown above.
- Endpoint [line 13 11 in ESB config] - Defines the back-end service the messages are passed to.
- timeout [line 15 13 in ESB config] - Defines the timeout duration in milliseconds, and also the action to take (fault or discard) in the event of a response timeout. In this example scenario, when a timeout occurs, the
LogAndDropMessageFault
sequence activates where the message is dropped using the Drop Mediator. An alternative to dropping the message is to pass the message to a Dead Letter Channel.