MuleSoft: How to Store and Retrieve Data in an Object Store Connector?

MuleSoft: How to Store and Retrieve Data in an Object Store Connector?

MuleSoft’s Object Store Connector provides a seamless solution for storing and retrieving data efficiently. By leveraging the Object Store Connector, developers can easily manage and access data within their MuleSoft applications. Let’s explore the streamlined process of storing and retrieving data using this powerful tool.

Finding the actual type of values:

No, we cannot store a value for an object store key in a String format using the ObjectStore v2 connector. In Runtime Manager, the value for the Object store key is displayed as Binary.

In Anypoint Platform, the value type of the respective key is shown as binary. Below is the information regarding the ObjectStore Retrieve and Store operations.

ObjectStore is a storage container.

Store: Saves the provided value using the specified key.

  • Drag and drop the ObjectStore: Store connector from the Mule Palette.
  • In the above image, we are storing the key (lookUpData) and the value (Massil).
  • Configure the connector properties.
  • Checking the data using the loggers.
  • Testing the API by postman.

Use Anypoint Platform Runtime Manager to deploy the APIs on CloudHub. In Runtime Manager, Object store displays respective keys and values. The values of any keys will always be binary, as illustrated in the image below.

To view the value, you can use the Object store retrieve function, which retrieves the stored data for the given key:

  • In the following image, we are trying to retrieve the value of (lookup data) key.
  • Drag and drop theĀ ObjectStore: Retrieve connector from the Mule Palette.
  • Configure the connector properties. Checking the data by using the loggers.

Testing the API by postman. Below is the screenshot.

Conclusion:

In Anypoint Platform’s Runtime Manager, the object store stores respective keys of any value as BINARY. To view the value, the object store uses the retrieve operation. For more information or queries on MuleSoft, please write to [email protected].