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
Click on Add
Define a new 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