From the technical center of excellence of Massil Technologies, our technology leaders make it easy to understand the complex situations you come across in Mule ESB from the experience of Massil Technologies to have countered them in their experience of working on client projects in real time. This blog talks about object store in Mule ESB. This blog is a part of series of blogs being authored and published by Massil Technologies for the benefit of the IT community globally.
What is Object Store?
Mule ESB provides facility to store objects in the mule application or across the project i.e. Object Store.Object store will store the objects for future retrieval. Mule internally uses Object Store in various filters, message processor..etc to store messages.
Mule provides two types of object stores:
Mule ESB persists data when an object store is explicitly configured to be persistent. Mule creates a default persistent store in the file system.
The in-memory store was the default But as of 3.5 Persistent Store is the default for ObjectStore.
Configuration of Object Store Connector:
MaxEntries: It will limit the no of the object to be stored in the object store.
TTL(Time to Live): It will say indicate the number of milliseconds that a cached response has to live in the object store.
Expiration Interval: Enter an integer to indicate, in milliseconds, the frequency with which the object store checks for cached response events it should expunge. For example, if you enter “1000”, the object store reviews all cached response events every one thousand milliseconds to see which ones have exceeded their Time To Live and should be expunged.
Key: Object Store will store your object with this Name. The naming of store name should be unique.
Value: Give which value want to store.
Contains: Object Store will check whether it contains the given key.
Dispose Store: Deletes the complete store
Dual Store: It will store the value with the key , also vice versa
Remove: It will remove the value of a key
Retrieve: It will retrieve the value of the key
Retrieve and Store: Retrieves and stores at the same operation
Store: Store the value with a key
For More Details go through the below documents:
Mule Docs: https://en.wikipedia.org/wiki/ObjectStore
AnyPointStudio won’t come with Object Store Connector we have to install it. You can install it from Exchange.
To install ObjectStore connector you need to login into Exchange with Anypoint Credentials. Login in to Exchange and Install the connector, When the installation complete studio will prompt to restart the studio. Say yes to that your studio will get restarted.
Take one Http and configure it as shown:
Take a variable from palette and give name and value for the variable.
Take objectStore from the palette and configure it like this
Take one file connector and configure it as shown:
Take a Flow and drag one HTTP connector to it.
Take an ObjectStore connector and do the configuration which has been done at first flow. In basic settings select retrieve option. In general, settings give the key name
Take a File connector, configure it same as the previous one
Lets’ run the application
>right click on the canvas
>select run project
Send some text from the postman.
The output is visible in the console shown below:
Again send the text to the second flow:
The above console shows the 5seconds time gap from one processor to another processor. Hence, we have gone through the step by step process to depict the way Massil Technologies team has addressed the scenario mentioned above. Hope this article from Massil Technologies was useful for you. If you have any further queries on this topic, please reach out to email@example.com.