SlideShare a Scribd company logo
By Anirban Sen Chowdhary
Timer Interceptor in Mule part 2
.
Here I will show you how ……
We can use a Mule component called custom-interceptor in
our flow
With this we can calculate the total amount of time
taken in our flow
So, we can take following Mule flow to demonstrate :-
So, we can use the following tag in our flow of our Mule config
to execute total time:-
<custom-interceptor
class="com.customInterceptor.TimerInterceptor" />
And our java class TimerInterceptor will be:-
public class TimerInterceptor extends AbstractInterceptingMessageProcessor
implements Interceptor {
private static Log logger = LogFactory.getLog(TimerInterceptor.class);
public MuleEvent process(MuleEvent event) throws MuleException {
long startTime = System.currentTimeMillis();
MuleEvent resultEvent = processNext(event);
if (logger.isInfoEnabled()) {
long executionTime = System.currentTimeMillis() - startTime;
logger.info("Custom Timer : "+resultEvent.getFlowConstruct().getName() + " took "
+ executionTime + "ms to process event ["
+ resultEvent.getId() + "]");
}
return resultEvent;
}
}
Now this is a complex web service that uses cache mechanism
in the flow and will fetch some data from the database
Now when we execute this flow, we will get the above in our console
Now since this flow uses a cache mechanism in the flow, if we
hit the service again , it will uses cache to fetch it’s data and it
will not hit the actual database.
So, in this case the execution time will be less as follow :-
Now when we execute this flow, we will get the above in our console
So, this is very simple, we just need to put the following
code in our flow to get the execution time:-
<custom-interceptor> with your own java class to
calculate the execution time
Hope you enjoyed the simple yet an amazing trick in Mule
Timer Interceptor in Mule part 2

More Related Content

What's hot (16)

PPTX
Mulesoft vm transport reference
kumar gaurav
 
PPTX
Mule esb :Data Weave
AnilKumar Etagowni
 
PPTX
Quartz component in mule demo
Sudha Ch
 
PPTX
Enjoy Munit with Mule
Bui Kiet
 
PPTX
Enabling Security For ActiveMQ JMX Access
Ramakrishna Narkedamilli
 
PPTX
Junit in mule demo
javeed_mhd
 
PPTX
Message properties component in Mule
Khan625
 
PPTX
Mule quartz
Praneethchampion
 
PPTX
For each component in mule
Rajkattamuri
 
PPTX
Mule with composite source
Anirban Sen Chowdhary
 
PPTX
Until successful component in mule
javeed_mhd
 
PPTX
Groovy example in mule
Mohammed246
 
PPTX
Quartz connector mule
Sindhu VL
 
PPTX
Compress and decompress
Son Nguyen
 
PPTX
Mule requestor component
Sindhu VL
 
PPTX
Encrypting/Decrypting mule
Anirban Sen Chowdhary
 
Mulesoft vm transport reference
kumar gaurav
 
Mule esb :Data Weave
AnilKumar Etagowni
 
Quartz component in mule demo
Sudha Ch
 
Enjoy Munit with Mule
Bui Kiet
 
Enabling Security For ActiveMQ JMX Access
Ramakrishna Narkedamilli
 
Junit in mule demo
javeed_mhd
 
Message properties component in Mule
Khan625
 
Mule quartz
Praneethchampion
 
For each component in mule
Rajkattamuri
 
Mule with composite source
Anirban Sen Chowdhary
 
Until successful component in mule
javeed_mhd
 
Groovy example in mule
Mohammed246
 
Quartz connector mule
Sindhu VL
 
Compress and decompress
Son Nguyen
 
Mule requestor component
Sindhu VL
 
Encrypting/Decrypting mule
Anirban Sen Chowdhary
 

More from Anirban Sen Chowdhary (20)

PPTX
Change the game with Game changer
Anirban Sen Chowdhary
 
PPTX
Ring central desktop app overview
Anirban Sen Chowdhary
 
PPTX
Overview in ringcentral digital line
Anirban Sen Chowdhary
 
PPTX
Some basics with ring central
Anirban Sen Chowdhary
 
PPTX
Ring central and python
Anirban Sen Chowdhary
 
PPTX
RingCentral application development overview
Anirban Sen Chowdhary
 
PPTX
Cloze connect ringcentral
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors part 4
Anirban Sen Chowdhary
 
PPTX
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
PPTX
Overview on ring central errors
Anirban Sen Chowdhary
 
PPTX
Call recording overview ring central
Anirban Sen Chowdhary
 
PPTX
Ring central engaging with amazon alexa
Anirban Sen Chowdhary
 
PPTX
How ring central sdk changing the game
Anirban Sen Chowdhary
 
PPTX
When ring central connect salesforce
Anirban Sen Chowdhary
 
PPTX
Mule 4 connecting ring central
Anirban Sen Chowdhary
 
PPTX
Ring central sdk
Anirban Sen Chowdhary
 
PPTX
Ring central with okta
Anirban Sen Chowdhary
 
PPTX
Ring central connecting salesforce overview
Anirban Sen Chowdhary
 
PPTX
Ring central call logs overview (part 2)
Anirban Sen Chowdhary
 
Change the game with Game changer
Anirban Sen Chowdhary
 
Ring central desktop app overview
Anirban Sen Chowdhary
 
Overview in ringcentral digital line
Anirban Sen Chowdhary
 
Some basics with ring central
Anirban Sen Chowdhary
 
Ring central and python
Anirban Sen Chowdhary
 
RingCentral application development overview
Anirban Sen Chowdhary
 
Cloze connect ringcentral
Anirban Sen Chowdhary
 
Overview on ring central errors part 4
Anirban Sen Chowdhary
 
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
Overview on ring central errors
Anirban Sen Chowdhary
 
Call recording overview ring central
Anirban Sen Chowdhary
 
Ring central engaging with amazon alexa
Anirban Sen Chowdhary
 
How ring central sdk changing the game
Anirban Sen Chowdhary
 
When ring central connect salesforce
Anirban Sen Chowdhary
 
Mule 4 connecting ring central
Anirban Sen Chowdhary
 
Ring central sdk
Anirban Sen Chowdhary
 
Ring central with okta
Anirban Sen Chowdhary
 
Ring central connecting salesforce overview
Anirban Sen Chowdhary
 
Ring central call logs overview (part 2)
Anirban Sen Chowdhary
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Biography of Daniel Podor.pdf
Daniel Podor
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Ad

Timer Interceptor in Mule part 2

  • 1. By Anirban Sen Chowdhary
  • 3. .
  • 4. Here I will show you how ……
  • 5. We can use a Mule component called custom-interceptor in our flow With this we can calculate the total amount of time taken in our flow
  • 6. So, we can take following Mule flow to demonstrate :-
  • 7. So, we can use the following tag in our flow of our Mule config to execute total time:- <custom-interceptor class="com.customInterceptor.TimerInterceptor" />
  • 8. And our java class TimerInterceptor will be:- public class TimerInterceptor extends AbstractInterceptingMessageProcessor implements Interceptor { private static Log logger = LogFactory.getLog(TimerInterceptor.class); public MuleEvent process(MuleEvent event) throws MuleException { long startTime = System.currentTimeMillis(); MuleEvent resultEvent = processNext(event); if (logger.isInfoEnabled()) { long executionTime = System.currentTimeMillis() - startTime; logger.info("Custom Timer : "+resultEvent.getFlowConstruct().getName() + " took " + executionTime + "ms to process event [" + resultEvent.getId() + "]"); } return resultEvent; } }
  • 9. Now this is a complex web service that uses cache mechanism in the flow and will fetch some data from the database Now when we execute this flow, we will get the above in our console
  • 10. Now since this flow uses a cache mechanism in the flow, if we hit the service again , it will uses cache to fetch it’s data and it will not hit the actual database. So, in this case the execution time will be less as follow :- Now when we execute this flow, we will get the above in our console
  • 11. So, this is very simple, we just need to put the following code in our flow to get the execution time:- <custom-interceptor> with your own java class to calculate the execution time
  • 12. Hope you enjoyed the simple yet an amazing trick in Mule