Object store connector in Mule 4 with a simple example

How to use Object Store connector in Mule 4



The object store connector of Mule 4 is used to store temporary information and retrieve them later. Let us have a look at some of its use cases
  • Storing synchronization information, such as watermarks to store the latest available records information.

  • Storing information such as access tokens and use them later.

  • Storing user information for lookup.

Object Store connector Flow Configuration



Configuration of Store component in Object Store connector:



Don't miss: How to setup watermark, ObjectStore in Mule 4 application 



Configuration of Retrieve component in Object Store connector:



Configuration of Object Store Connector Properties:




To test the above flow, just hit the objectstore-retrieveFlow and observe that value stored in objectstore-storeFlow is retrieved

List of operations in Mule 4 Object store connector:

Clear: Removes all the stored information in the store.

Contains Verifies if there is any value already assigned to the given key. If there is no value associated for the key, then false is returned

Remove: Removes the value associated with the given key. If no value exists for the key, then an OS: KEY_NOT_FOUND error is thrown.

Retrieve: Retrieves the value stored for the given key. If no value exists for the key, it retrieves the values stored on the defaultValue parameter.

Retrieve All: Retrieves all the key-value pairs in the object-store.

Retrieve All Keys: Returns a List containing all keys that the object store currently holds values for.


Store: Stores the given value using the given key. This operation can be used either for storing new values or updating existing ones, depending on the value of the failIfPresent


Find the latest MuleSoft(Mule 4) Articles on DataWeave, Anypoint Studio, Anypoint Platform, and Runtime Manager. Our articles also include frequently asked Mule4 Interview questions and answers. Please comment below for any queries or free article submissions.

Post a Comment

0 Comments