Store key-value in Object Store

 

Store key-value in Object Store will store the value against the key in Object Store. As POC we will create an API which will accept the key as header and save the body as value in Object Store (OS).

Drag and drop Object Store – Store activity in mule flow

Store key-value in Object Store

 

Click on Add

Store key-value in Object Store

 

Define a new Object Store

Store key-value in Object Store

 

Here we can select

  • Persistent – in case if we want to save the information in OS in case of application/runtime restart.
  • Max entries – max keys we want to store in OS
  • Entry ttl – time to live is defining the life/duration of key after which the key will get expired. E.g. say 1 hour, so after an hour key will get expired
  • Expiration interval – is defined to tell mule runtime when to collect expired keys from object store. Appropriate time is half of ttl
  • Configuration reference – this is needed in case of Cloudhub as ttl/expiration configuration will not work in Cloudhub in case OS is persistent. Check more on this – https://docs.mulesoft.com/object-store/

 

Let’s define the same and click OK

 

This will create an Object_store which can be used across different OS activity

 

Run the application and test it through SOAP UI

 

Sample mule application – object-store-sample

Sample SOAP UI Project – Object-Store-Sample-soapui-project

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
leonardo
leonardo
3 years ago

Great post!

Nehal
Nehal
1 year ago

What is the difference between Time to Live and Expiration interval? What happens if we set ttl as 5 mins and expiration interval as 10 mins and try to retrieve value using key after 5 mins but before 10 mins? And also what will be the value after we try to retrieve after 10 mins? Can you please also explain the difference?