Reputation: 1942
Is there any way to get the response time of an endpoint in MULE? Example is the Http Connector in mule, I need to get the response time of the invoked endpoint.
Upvotes: 1
Views: 919
Reputation: 1942
I was able to solve my problem by using Mule Server Notification.
There is an interface MessageProcessorNotificationListener which can listen to PRE/POST invoke of a message processor.
I have achieved to get the response time of an message processor using the following code.
long startTime;
if (m.getAction() == MessageProcessorNotification.MESSAGE_PROCESSOR_PRE_INVOKE)
{
startTime = System.currentTimeMillis();
}
if (m.getAction() == MessageProcessorNotification.MESSAGE_PROCESSOR_POST_INVOKE)
{
long executionTime = System.currentTimeMillis() - startTime;
AbstractEndpoint ep = (AbstractEndpoint) proc;
log.info("Http call to : "+ ep.getName() + " took " + executionTime + "ms response time");
}
Here is the response
Http call to : endpoint.http.google.com.80 took 224ms response time.
Upvotes: 2
Reputation: 4704
What you actually need to leverage to take some statistics around the endpoints are server notifications, please see the following documentation page:
https://developer.mulesoft.com/docs/display/current/Mule+Server+Notifications
Check out the endpoint notification.
Upvotes: 1