2. 2
Object store in MULE ESB
Object Store comes under concept of CACHE mechanism in the MULE
ESB
Object Store Module allows you to manipulate the object stores within the
MULE applications.
It allows you to store, remove and retrieve objects from the store
3. 3
Object store in MULE ESB-example
Here I will show example of using object store in the mule application.
Object store need to install separately from Studio , please follow below instructions to do the
installation.
•Click on Help->InstallNewSoftware
•Select the repository for the connectors
(http://repository.mulesoft.org/connectors/releases/3.5.0)
4. 4
Object store in MULE ESB-example
• Select the object store, follow the instructions and install it.
• Restart Anypoint Studio to reflect the changes
• You will be able to see the object store symbol in the Mule palette.
5. 5
Object store in MULE ESB-example
In this example – we are creating and store the session id the user for order process.
First create flow, use custom java component to generate some id (this id will be considering
as session id with in the application) and set the value to user variable as part of flowvars
Place mule object store next to it and configure the operation as store
Use ‘store’ operation to store the session id. when the user visits next time in same session ,
we can validated the id which is their in the object store to identify the user without checking
his past history or conversation.
6. 6
Object store in MULE ESB-example
Object store configuration used in the example
7. 7
Object store in MULE ESB-example
Supported operations in Object store
Config- Configure an instance of the object store module. Various attributes determine the
type of object store to be created
Store – Stores an object in the store
Retrieve – retrieve the object from the store
Contains – checks the object is present or not in the store
Retrieve with lock - Locks the object store and retrieves the given value object for the
supplied key object
Remove – Remove the object from the store
8. 8
Object store in MULE ESB-example
Partition – Name of the partition in the default in-memory or persistent object store
ObjectStore-ref – Optional
entryTtl- Time To Live for stored values
Expiration Interval – specifies the expiration check interval for the stored values in milliseconds
maxEntries – specify the maiximum no of entries to be stored in the store
Persistent – Specify true if the object store required to be persistent else false