Object Store Connector in Mule4 allows you to save data as a key-value pair and access it later for any transformation or condition logic. The Object Store is primarily used to store watermarks, access tokens, and user information as a key-value pair.
Mule Runtime uses Object Stores to support some of its components, for example:
- The Cache module uses an Object Store to maintain all of the cached data.
- The OAuth module (and every OAuth-enabled connector) uses Object Stores to store the access and refresh tokens.
- By default, each Mule app has an Object Store that is persistent and always available to the app without any configuration.
- Flows can use it to persist and share data.
Types of Object Store:
- Persistent: This is the default option for the ObjectStore. By using this option, stored data stays in the system even if the system or its runtime is down.
- In-Memory: Though this functionality is not available explicitly, it can be selected. By not selecting the persistent option, ObjectStore, by default, becomes in-memory.
Mule4 has an inbuilt connector for Object Store. Object Store Connector in Mule4 provides 7 types of operation:
- Store: Stores the given value using the given key.
- Retrieve: Retrieves the value stored for the given key. If there is no key with the given name then the default value is returned.
- Retrieve all keys: Returns a list of all keys that the object store currently holds values for.
- Retrieve all: Retrieves all the key-value pairs present in the object-store.
- Contains Checks if there is any value exists to the given key. If no value exists for the key, then a false is returned.
- Remove: Removes the value associated with the given key from the object store.
- Clear: Clears all the contents in the store. It removes all the content (keys and values) from the object-store.
Object Store Limitations:
- Do not support transactional access or modification.
- This is not an alternative for Databases.