SlideShare a Scribd company logo
1 of 18
Caching and invalidating with
managed-store
Today’s topic we will be discussing the
NonPersistentManagedObjectStore and we will not be doing
any complex Caching configuration with spring beans in our
Mule config.
.
How ??? I will show you how
.
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.
Caching and invalidating with NonPersistentManagedObjectStore

More Related Content

What's hot

How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in muleRamakrishna kapa
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeAnirban Sen Chowdhary
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB IntegrationAnilKumar Etagowni
 
Memcache basics on google app engine
Memcache basics on google app engineMemcache basics on google app engine
Memcache basics on google app engineIdo Green
 
Activemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker dataActivemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker dataRamakrishna Narkedamilli
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connectorGermano Barba
 
Link Header-based Invalidation of Caches
Link Header-based Invalidation of CachesLink Header-based Invalidation of Caches
Link Header-based Invalidation of Cachesmikekelly
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input dataAnilKumar Etagowni
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mulePraneethchampion
 

What's hot (12)

How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in mule
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Memcache basics on google app engine
Memcache basics on google app engineMemcache basics on google app engine
Memcache basics on google app engine
 
Activemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker dataActivemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker data
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connector
 
Link Header-based Invalidation of Caches
Link Header-based Invalidation of CachesLink Header-based Invalidation of Caches
Link Header-based Invalidation of Caches
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input data
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Configuring Wordpress W3 Total Cache
Configuring Wordpress W3 Total CacheConfiguring Wordpress W3 Total Cache
Configuring Wordpress W3 Total Cache
 

Viewers also liked

Scatter gather flow control
Scatter gather flow control Scatter gather flow control
Scatter gather flow control mdfkhan625
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple filemdfkhan625
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentationschollaerte
 
Matric certificate
Matric certificateMatric certificate
Matric certificateZanele Zondo
 
Webservice with vm
Webservice with vm Webservice with vm
Webservice with vm mdfkhan625
 
RTB Bor FSF Paljenje gorionika
RTB Bor FSF Paljenje gorionikaRTB Bor FSF Paljenje gorionika
RTB Bor FSF Paljenje gorionikaZoran Todorovski
 
Classification of Computer Networks
Classification of Computer Networks Classification of Computer Networks
Classification of Computer Networks Nazren Wak
 

Viewers also liked (13)

Scatter gather flow control
Scatter gather flow control Scatter gather flow control
Scatter gather flow control
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
SKMBT_C22415032314131
SKMBT_C22415032314131SKMBT_C22415032314131
SKMBT_C22415032314131
 
Kursir2
Kursir2Kursir2
Kursir2
 
Matric certificate
Matric certificateMatric certificate
Matric certificate
 
Kursir1
Kursir1Kursir1
Kursir1
 
Kauppalehti280909
Kauppalehti280909Kauppalehti280909
Kauppalehti280909
 
Webservice with vm
Webservice with vm Webservice with vm
Webservice with vm
 
Zoran Ref Letter
Zoran Ref LetterZoran Ref Letter
Zoran Ref Letter
 
RTB Bor FSF Paljenje gorionika
RTB Bor FSF Paljenje gorionikaRTB Bor FSF Paljenje gorionika
RTB Bor FSF Paljenje gorionika
 
Figuras
FigurasFiguras
Figuras
 
Classification of Computer Networks
Classification of Computer Networks Classification of Computer Networks
Classification of Computer Networks
 

Similar to Caching and invalidating with NonPersistentManagedObjectStore

Similar to Caching and invalidating with NonPersistentManagedObjectStore (20)

Mule esb
Mule esbMule esb
Mule esb
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule esb DataWeave
Mule esb DataWeaveMule esb DataWeave
Mule esb DataWeave
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule esb:DataWeave
Mule esb:DataWeaveMule esb:DataWeave
Mule esb:DataWeave
 
Mule esb
Mule esb Mule esb
Mule esb
 
Mule esb dataweave
Mule esb dataweaveMule esb dataweave
Mule esb dataweave
 
Mule esb Data Weave
Mule esb Data WeaveMule esb Data Weave
Mule esb Data Weave
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in mule
 
Mule Esb Data Weave
Mule Esb Data WeaveMule Esb Data Weave
Mule Esb Data Weave
 
Active mq Installation and Master Slave setup
Active mq Installation and Master Slave setupActive mq Installation and Master Slave setup
Active mq Installation and Master Slave setup
 
Mulesoft xml to Java Conversion
Mulesoft xml to Java ConversionMulesoft xml to Java Conversion
Mulesoft xml to Java Conversion
 
Using jersey exception mapper
Using jersey exception mapperUsing jersey exception mapper
Using jersey exception mapper
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in mule
 
Servlets
ServletsServlets
Servlets
 
Servlets Java Slides & Presentation
Servlets Java Slides & Presentation Servlets Java Slides & Presentation
Servlets Java Slides & Presentation
 
19servlets
19servlets19servlets
19servlets
 

More from mdfkhan625

Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mulemdfkhan625
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties componentmdfkhan625
 
How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filtermdfkhan625
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gatewaymdfkhan625
 
Webservice with vm in mule
Webservice with vm in mule Webservice with vm in mule
Webservice with vm in mule mdfkhan625
 
Validating soap request in mule
Validating soap request in mule Validating soap request in mule
Validating soap request in mule mdfkhan625
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule mdfkhan625
 
Groovy example in mule
Groovy example in mule Groovy example in mule
Groovy example in mule mdfkhan625
 
Mule with velocity
Mule with velocity Mule with velocity
Mule with velocity mdfkhan625
 
Mule with rabbit mq
Mule with rabbit mq Mule with rabbit mq
Mule with rabbit mq mdfkhan625
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartzmdfkhan625
 
Mule with drools
Mule with drools Mule with drools
Mule with drools mdfkhan625
 
Creating dynamic json
Creating dynamic json Creating dynamic json
Creating dynamic json mdfkhan625
 
Converting with custom transformer
Converting with custom transformer Converting with custom transformer
Converting with custom transformer mdfkhan625
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition mdfkhan625
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule mdfkhan625
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mulemdfkhan625
 
Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalonemdfkhan625
 

More from mdfkhan625 (20)

Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
 
How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filter
 
Data weave
Data weave Data weave
Data weave
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Webservice with vm in mule
Webservice with vm in mule Webservice with vm in mule
Webservice with vm in mule
 
Validating soap request in mule
Validating soap request in mule Validating soap request in mule
Validating soap request in mule
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule
 
Groovy example in mule
Groovy example in mule Groovy example in mule
Groovy example in mule
 
Mule with velocity
Mule with velocity Mule with velocity
Mule with velocity
 
Mule with rabbit mq
Mule with rabbit mq Mule with rabbit mq
Mule with rabbit mq
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartz
 
Mule with drools
Mule with drools Mule with drools
Mule with drools
 
Creating dynamic json
Creating dynamic json Creating dynamic json
Creating dynamic json
 
Converting with custom transformer
Converting with custom transformer Converting with custom transformer
Converting with custom transformer
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
 
Java
JavaJava
Java
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalone
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Caching and invalidating with NonPersistentManagedObjectStore

  • 1. Caching and invalidating with managed-store
  • 2. Today’s topic we will be discussing the NonPersistentManagedObjectStore and we will not be doing any complex Caching configuration with spring beans in our Mule config. .
  • 3. How ??? I will show you how .
  • 4. So, let us consider we have configured a web service with the Mule cache scope in following way:-
  • 5. <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 :-
  • 6. 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 ?
  • 7. 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.
  • 8. 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.
  • 9. 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:-
  • 10. With this in place, if we again hit the service, we will get the same response as we got earlier:-
  • 11. 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
  • 12. 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:-
  • 13. 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.
  • 14. Now if we hit the url:- http://localhost:8083/invalidate following way :-
  • 15. 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.
  • 16. 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.
  • 17. Hope you enjoyed the simple usage of Cache with NonPersistentManagedObjectStore and the way of invalidating it.