Date calculation in WSO2 ESB

Jenananthan
1 min readApr 13, 2018

--

Use case : When a customer buy a product, transaction need to add an entry in database of return date(Customer can return the product before this date)

Return date should be calculated as below

Return date = Transaction Date + 12 days

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

This can acheived in WSO2 ESB in two ways,
1. Script mediator
2. Custom class mediator

This post will explain how to use the script mediator and achieve this. WSO2 script mediator uses Rahino engine, therefore it is possible to use the java code inside the script mediator.

Below proxy is written to achieve the Use case. Where it uses Java’s libraries to calculate the date in Script mediator.

--

--