10
Mule Cache with REST services

Mule cache with rest services

Embed Size (px)

Citation preview

Page 1: Mule cache with rest services

Mule Cache with REST services

Page 2: Mule cache with rest services

In my previous slide I have demonstrate how to use Cache with SOAP web service.This time I am going to use the Cache in REST web service

Page 3: Mule cache with rest services

How to use Cache with REST in Mule ??

Page 4: Mule cache with rest services

To use Cache with Mule we have to construct our flow in following way :-

You can see the flow is divided into 2 parts and is connected by VM component. Just the only extra effort we need is to copy all HTTP headers before sending it through VM as the HTTP headers may lost while travelling through VM. We have use the VM component to Cache the flow and the Web service request

Page 5: Mule cache with rest services

Our Mule config will be as follow:-

Page 6: Mule cache with rest services

Now, our flow is ready .. If we can test our flow in REST client using the url :- http://localhost:8082/getData/retrieve/?id=2 which will retrieve all the value from the database with id=2 as follows :-

Page 7: Mule cache with rest services

Now we will manually delete the record from Database whose id is 2 as follows :-

You can see I have deleted the entire row from the table with id=2 from Database

Page 8: Mule cache with rest services

Now, If we hit the same url with same id=2 in REST client using the url :- http://localhost:8082/getData/retrieve/?id=2 we will get the same result which means it’s actually taking the response from Cache and not from Database !!!

Page 9: Mule cache with rest services

In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow

Page 10: Mule cache with rest services

Thank You