SlideShare a Scribd company logo
CACHING &
VALIDATING
THE NONPERSISTENT MANAGED OBJECTS TORE AND
WE WILL NOT BE DOING ANY COMPLEX CACHING
CONFIGURATION WITH SPRING BEANS IN OUR MULE
CONFIG.
.
So, let us consider we have configured a web service with the Mule
cache scope in following way:-
<FLOW NAME="SERVICEFLOW" DOC:NAME="SERVICEFLOW">
<HTTP:INBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" HOST="LOCALHOST"
PORT="8082" PATH="MAINDATA" DOC:NAME="HTTP" />
<OBJECT-TO-STRING-TRANSFORMER DOC:NAME="OBJECT TO STRING"/>
<EE:CACHE DOC:NAME="CACHE" CACHINGSTRATEGY-REF="CACHINGSTRATEGY" >
<VM:OUTBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" PATH="FLOW1-WT-MAIN"
DOC:NAME="VM"/>
<OBJECT-TO-STRING-TRANSFORMER DOC:NAME="OBJECT TO STRING"/>
</EE:CACHE>
</FLOW>
<FLOW NAME="SERVICEFLOW2" DOC:NAME="SERVICEFLOW2">
<VM:INBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" PATH="FLOW1-WT-MAIN"
DOC:NAME="VM"/>
<CXF:JAXWS-SERVICE SERVICECLASS="COM.TEST.SERVICES.SCHEMA.MAINDATA.V1.MAINDATA"
DOC:NAME="SOAP"/>
<COMPONENT CLASS="COM.TEST.SERVICES.SCHEMA.MAINDATA.V1.IMPL.MAINDATAIMPL"
DOC:NAME="JAVAMAIN_SERVICEIMPL"/>
</FLOW>
Corresponding Mule flow will be :-
Now we will configure our cachingStrategy with
NonPersistentManagedObjectStore as follows:-
<ee:object-store-caching-strategy name="cachingStrategy"
doc:name="cachingStrategy"> <managed-
store storeName="myNonPersistentManagedObjectStore" maxEntries="-
1" entryTTL="20000" expirationInterval="5000"/>
</ee:object-store-caching-strategy>
So it is very simple right ?
In next step we will be running and testing the application. This
web servicewill intereact with database retrieve a row from the
database and show the row value in the SOAP response.
Here how we will test the web service :-
You can see that we have used SoapUI to test the web service. Now when we
hit the service, you can see in the SOAP request, it takes id as input and then
fetches all the data from the database for that id.
Now, what we will do is manually deleting the entire row from
the database. In my case, I have used sql server and deleted
the row from the table using a SQL query:-
With this in place, if we again hit the service, we will get the
same response as we got earlier:-
You can see that, though the entire row is deleted from the
database table, it’s still showing the response, which means it is
fetching the response from cache and not hitting the actual
database
Now, let’s create a Mule flow that will invalidate and clear all
the Cache
So, with following flow we can clear all the Cache that has
been used:-
Corresponding Mule config will be :-
<flow name="cacheinvalidate" doc:name="cacheinvalidate">
<http:inbound-endpoint exchange-pattern="request-response"
address="http://localhost:8083/invalidate" doc:name="HTTP"/>
<object-to-string-transformer doc:name="Object to String"/>
<ee:invalidate-cache cachingStrategy-ref="cachingStrategy"/>
<set-payload value="All cache invalidated" doc:name="Set
Payload"/>
</flow>
As we can see the above flow will use ee:invalidate-cache to clear all
the cache.
Now if we hit the url:- http://localhost:8083/invalidate
following way :-
So, we can hit the web service again to test the output.
So, now if we hit service again after the cache has been
invalidated, we will find the following result
As you can see, it clearly shows no records are there in the database, which
means the cache has invalidated successfully and the service is actually
hitting the database.
It’s simple example.. isn’t it … we don’t need to configure any
complex configuration for the cache as compared to the
configuration we need to do in case of using cache with
EHCache.
Hope you enjoyed the simple usage of Cache with
NonPersistentManagedObjectStore and the way of
invalidating it.

More Related Content

PPTX
Compress and decompress
PPTX
Integrate with database by groovy
PDF
MuleSoft ESB Message Enricher
ODP
Box connector Mule ESB Integration
PPTX
Mule jdbc
ODP
Running ms sql stored procedures in mule
PPT
Spring introduction
PPTX
Mule Esb Data Weave
Compress and decompress
Integrate with database by groovy
MuleSoft ESB Message Enricher
Box connector Mule ESB Integration
Mule jdbc
Running ms sql stored procedures in mule
Spring introduction
Mule Esb Data Weave

What's hot (9)

PPTX
MuleSoft ESB scatter-gather and base64
PPTX
Mule esb :Data Weave
ODP
Mule ESB SMTP Connector Integration
PDF
Refreshing mule cache using oracle database change notification
PPTX
Caching and invalidating with managed store
 
PPT
MuleSoft ESB Object Store
PPTX
Mule XML java sample
PPTX
Mulexml java
PPTX
Caching and invalidating with managed store
MuleSoft ESB scatter-gather and base64
Mule esb :Data Weave
Mule ESB SMTP Connector Integration
Refreshing mule cache using oracle database change notification
Caching and invalidating with managed store
 
MuleSoft ESB Object Store
Mule XML java sample
Mulexml java
Caching and invalidating with managed store
Ad

Viewers also liked (18)

PPTX
Expression language
PPTX
Xml to xml transformation
PPTX
Analytics event api
TXT
Judul skripsi untuk pembuatan proposal
PPTX
Bab x konsep pendapatan
PDF
Clarus campus, Klaarkamp 1165-1965
PPTX
Deploying to cloud hub
PPTX
Managerial Accounting & It;s Overview
PPT
TENDENZA EVOLUTIVA E SOLUZIONI PER LA SPIAGGIA DI LEVANTO
PPT
Tugas akhir
DOC
Cover dan daftar isi Proposal Tugas Akhir
PDF
KHI (Kompilasi Hukum Islam)
PPTX
Metabolisme mikroba
PPTX
KUHP(KITAB UNDANG-UNDANG HUKUM PIDANA); DADANG DJOKO KARYANTO; MODUL 1
PPT
Tugas proposal penelitian
DOCX
Laporan Resmi Praktikum Biologi Fermentasi Alkohol
PPT
Sholat jumat
Expression language
Xml to xml transformation
Analytics event api
Judul skripsi untuk pembuatan proposal
Bab x konsep pendapatan
Clarus campus, Klaarkamp 1165-1965
Deploying to cloud hub
Managerial Accounting & It;s Overview
TENDENZA EVOLUTIVA E SOLUZIONI PER LA SPIAGGIA DI LEVANTO
Tugas akhir
Cover dan daftar isi Proposal Tugas Akhir
KHI (Kompilasi Hukum Islam)
Metabolisme mikroba
KUHP(KITAB UNDANG-UNDANG HUKUM PIDANA); DADANG DJOKO KARYANTO; MODUL 1
Tugas proposal penelitian
Laporan Resmi Praktikum Biologi Fermentasi Alkohol
Sholat jumat
Ad

Similar to Caching & validating (15)

PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPT
Cache scope and strategy
PPT
Cachescope
PPTX
Caching strategies in MuleSoft
PPTX
Improving performance with cache scope in mule
PPTX
How to use Cache scope
Caching and invalidating with managed store
Caching and invalidating with managed store
Caching invalidating with managed store
Caching and invalidating with managed store
Caching invalidating with managed store
Caching and invalidating with managed store
Caching and invalidating with managed store
Caching and invalidating with managed store
Caching and invalidating with managed store
Caching and invalidating with managed store
Cache scope and strategy
Cachescope
Caching strategies in MuleSoft
Improving performance with cache scope in mule
How to use Cache scope

More from Son Nguyen (20)

PPTX
Wsdl connector introduction
PPTX
Android intergrate with mule
PPTX
Mule flow overview
PPTX
Mule flow and filter
PPTX
Handle exceptions in mule
PPT
Spring security integrate with mule
PPTX
Message processor in mule
PPTX
Expression language in mule
PPTX
Mule with data weave
PPTX
Using spring scheduler mule
PPTX
Composite source in bound and out-bound
PPT
Batch job processing
PPTX
Using message enricher
PPT
Finance connectors with mule
PPT
Google drive connection
PPTX
Using properties in mule
PPT
Mule integrate with microsoft
PPTX
Jms queue
PPT
Anypoint connectors
PPTX
Mule esb basic introduction
Wsdl connector introduction
Android intergrate with mule
Mule flow overview
Mule flow and filter
Handle exceptions in mule
Spring security integrate with mule
Message processor in mule
Expression language in mule
Mule with data weave
Using spring scheduler mule
Composite source in bound and out-bound
Batch job processing
Using message enricher
Finance connectors with mule
Google drive connection
Using properties in mule
Mule integrate with microsoft
Jms queue
Anypoint connectors
Mule esb basic introduction

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Digital-Transformation-Roadmap-for-Companies.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Caching & validating

  • 2. THE NONPERSISTENT MANAGED OBJECTS TORE AND WE WILL NOT BE DOING ANY COMPLEX CACHING CONFIGURATION WITH SPRING BEANS IN OUR MULE CONFIG. .
  • 3. So, let us consider we have configured a web service with the Mule cache scope in following way:-
  • 4. <FLOW NAME="SERVICEFLOW" DOC:NAME="SERVICEFLOW"> <HTTP:INBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" HOST="LOCALHOST" PORT="8082" PATH="MAINDATA" DOC:NAME="HTTP" /> <OBJECT-TO-STRING-TRANSFORMER DOC:NAME="OBJECT TO STRING"/> <EE:CACHE DOC:NAME="CACHE" CACHINGSTRATEGY-REF="CACHINGSTRATEGY" > <VM:OUTBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" PATH="FLOW1-WT-MAIN" DOC:NAME="VM"/> <OBJECT-TO-STRING-TRANSFORMER DOC:NAME="OBJECT TO STRING"/> </EE:CACHE> </FLOW> <FLOW NAME="SERVICEFLOW2" DOC:NAME="SERVICEFLOW2"> <VM:INBOUND-ENDPOINT EXCHANGE-PATTERN="REQUEST-RESPONSE" PATH="FLOW1-WT-MAIN" DOC:NAME="VM"/> <CXF:JAXWS-SERVICE SERVICECLASS="COM.TEST.SERVICES.SCHEMA.MAINDATA.V1.MAINDATA" DOC:NAME="SOAP"/> <COMPONENT CLASS="COM.TEST.SERVICES.SCHEMA.MAINDATA.V1.IMPL.MAINDATAIMPL" DOC:NAME="JAVAMAIN_SERVICEIMPL"/> </FLOW> Corresponding Mule flow will be :-
  • 5. Now we will configure our cachingStrategy with NonPersistentManagedObjectStore as follows:- <ee:object-store-caching-strategy name="cachingStrategy" doc:name="cachingStrategy"> <managed- store storeName="myNonPersistentManagedObjectStore" maxEntries="- 1" entryTTL="20000" expirationInterval="5000"/> </ee:object-store-caching-strategy> So it is very simple right ?
  • 6. In next step we will be running and testing the application. This web servicewill intereact with database retrieve a row from the database and show the row value in the SOAP response.
  • 7. Here how we will test the web service :- You can see that we have used SoapUI to test the web service. Now when we hit the service, you can see in the SOAP request, it takes id as input and then fetches all the data from the database for that id.
  • 8. Now, what we will do is manually deleting the entire row from the database. In my case, I have used sql server and deleted the row from the table using a SQL query:-
  • 9. With this in place, if we again hit the service, we will get the same response as we got earlier:-
  • 10. You can see that, though the entire row is deleted from the database table, it’s still showing the response, which means it is fetching the response from cache and not hitting the actual database
  • 11. Now, let’s create a Mule flow that will invalidate and clear all the Cache So, with following flow we can clear all the Cache that has been used:-
  • 12. Corresponding Mule config will be :- <flow name="cacheinvalidate" doc:name="cacheinvalidate"> <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8083/invalidate" doc:name="HTTP"/> <object-to-string-transformer doc:name="Object to String"/> <ee:invalidate-cache cachingStrategy-ref="cachingStrategy"/> <set-payload value="All cache invalidated" doc:name="Set Payload"/> </flow> As we can see the above flow will use ee:invalidate-cache to clear all the cache.
  • 13. Now if we hit the url:- http://localhost:8083/invalidate following way :-
  • 14. So, we can hit the web service again to test the output. So, now if we hit service again after the cache has been invalidated, we will find the following result As you can see, it clearly shows no records are there in the database, which means the cache has invalidated successfully and the service is actually hitting the database.
  • 15. It’s simple example.. isn’t it … we don’t need to configure any complex configuration for the cache as compared to the configuration we need to do in case of using cache with EHCache.
  • 16. Hope you enjoyed the simple usage of Cache with NonPersistentManagedObjectStore and the way of invalidating it.