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
 

Similar to Timer Interceptor in Mule part 2 (20)

PDF
Timers in Unix/Linux
geeksrik
 
PPTX
Introdução à programação orientada para aspectos
Manuel Menezes de Sequeira
 
PDF
I os 06
信嘉 陳
 
PDF
Asyc flow control with javascript generators - redux-saga
Pedro Solá
 
PPTX
Contiki os timer tutorial
Salah Amean
 
PPTX
Timer Interceptor in Mule
Anirban Sen Chowdhary
 
PDF
Military time and Standard time, JavaOne of the assignments given .pdf
marketing413921
 
PPTX
Interceptor in mule
Son Nguyen
 
DOCX
A Project Run@Timer, J2SE,
Swapnil Dubey
 
PDF
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
NETWAYS
 
PDF
Appium Automation with Kotlin
RapidValue
 
PDF
Jsp session tracking
rvarshneyp
 
PPTX
Timer control
Nyasa Tyagi
 
PPTX
Mocking with salesforce using Munit
Son Nguyen
 
PDF
倒计时优化点滴
j5726
 
PPT
Session13 J2ME Timer
muthusvm
 
PDF
Proposed pricing model for cloud computing
Adeel Javaid
 
PPTX
Moment.js overview
Oleksii Prohonnyi
 
DOCX
C++ C++ C++ In Chapter 1- the class clockType was designed to implem.docx
CharlesCSZWhitei
 
PDF
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Yauheni Akhotnikau
 
Timers in Unix/Linux
geeksrik
 
Introdução à programação orientada para aspectos
Manuel Menezes de Sequeira
 
I os 06
信嘉 陳
 
Asyc flow control with javascript generators - redux-saga
Pedro Solá
 
Contiki os timer tutorial
Salah Amean
 
Timer Interceptor in Mule
Anirban Sen Chowdhary
 
Military time and Standard time, JavaOne of the assignments given .pdf
marketing413921
 
Interceptor in mule
Son Nguyen
 
A Project Run@Timer, J2SE,
Swapnil Dubey
 
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
NETWAYS
 
Appium Automation with Kotlin
RapidValue
 
Jsp session tracking
rvarshneyp
 
Timer control
Nyasa Tyagi
 
Mocking with salesforce using Munit
Son Nguyen
 
倒计时优化点滴
j5726
 
Session13 J2ME Timer
muthusvm
 
Proposed pricing model for cloud computing
Adeel Javaid
 
Moment.js overview
Oleksii Prohonnyi
 
C++ C++ C++ In Chapter 1- the class clockType was designed to implem.docx
CharlesCSZWhitei
 
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Yauheni Akhotnikau
 
Ad

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)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Digital Circuits, important subject in CS
contactparinay1
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

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