Search code examples
mulemule-esb

Response Time for a web serivice in mule ESB?


How do i get the response time of a POST request of web service in MULE ESB platform?


Solution

  • enter image description here

    you can use a variable to set the current time and then calculate the response time after you make your request or connector operation.

    set current time in the response variable using dataweave

    dw::util::Timer::currentMilliseconds()
    

    calculate the response time later using a transformer where you set the result of the transformation to the responseTime

    %dw 2.0
    import dw::util::Timer
    output application/json
    ---
    Timer::currentMilliseconds() - vars.responseTime