Tutorial: Object Store v2

This document helps you use Object Store v2 (OSv2) to store and view data.

To Install the Object Store Connector

  1. In Anypoint Studio, click the Exchange icon in the Studio taskbar.

  2. Click Login in Anypoint Exchange.

  3. Search for the ObjectStore connector and click Install.

  4. Follow the prompts to install the connector.

Updates: When Studio has an update, a message displays in the lower right corner, which you can click to install the update.

Create a Studio Project

  1. Open Anypoint Studio and create a new project using File > New > Mule Project. In this tutorial, the project name is objstoredemo.

  2. Create an application like this:


  3. Search for http and drag and drop the HTTP connector onto the Studio Canvas. The HTTP connector listens for the curl command we use to store a key and value in Object Store.

    Click the green plus to the right of Connector Configuration and in the Global Element Properties screen, take the default settings (Host: and Port: 8081) and click OK:


  4. In the HTTP properties screen, set Path to /store and Allowed Methods to POST:


    When we submit our curl command, we use the /store option in our URL, for example, The Allowed Methods setting ensures that those using our curl command can only POST information to the object store.

  5. Locate and add the Object to String component to the Studio Canvas. No settings are necessary — this component converts the content received from the HTTP connector into a string.

  6. Locate and add the JSON to Object component. Set the Return Class to java.util.Map:


  7. Search for objectstore and add the ObjectStore connector. If there is no object store connector, install it as described in To Install the Object Store Connector.

    1. Click the green plus sign to the right of Connector Configuration and in the Global Element Properties screen, assign a Partition name, such as MyPartition. Leave the remaining settings blank, and click OK.

    2. Set the Operation to Store and set these Store operation values:

      • Key to #[payload.key]

      • Value Reference to #[payload.value]


  8. Locate and add Set Payload. Set the Value field to KEY: #[payload.key] AND VALUE: #[payload.value] WERE SAVED OK - this message displays on the command line to let you know the curl command values are received by the application.


  9. Save the application and click Run > Run As > Mule Application. Running the application ensures your application works correctly. If you need to fix anything, do so now. After your application runs correctly, you can stop your application.

To Deploy Your Application in Anypoint Platform

  1. In Anypoint Platform > Runtime Manager, go to the Production environment and stop an application to free up a Runtime Manager worker so that you can complete this demo.

  2. In Studio, right-click your application’s name in Package Explorer and click Anypoint Platform > Deploy to Cloud.

  3. At the User login window, specify your Anypoint Platform username and password, and click Sign in. If you don’t have an Anypoint Platform login, click Sign up.

  4. In Runtime Manager:

    • Specify an application a name. Each name is unique and becomes the URL under which your application is available in Runtime Manager. The URL has the format where your application resides in the namespace. Ensure the application name gets a green checkmark for proper naming and being unique.

    • Set the Runtime Version. Ensure that the Runtime exposes the Use Object Store v2 checkbox, for example, version 3.7.5 exposes the checkbox whereas version 3.9.0 does not.

    • Click the Use Object Store v2 checkbox.


  5. After configuring your application, click Deploy Application.

  6. After your application deploys, open the browser view, and click the right side of the entry to view details.

  7. Click the down arrow next to Undeployed and click Start. Starting may take a few minutes to occur.

Sending Data to the Object Store

From a command line prompt, use a utility to send JSON data to your Mule application. This can be a command such as curl, Postman, or a browser extension. Any serializable data can be sent to the object store. The object store connector sends data as key/value pairs.

Example using curl:

curl -X POST -H "Content-Type: application/json" -d '{ "key": "TestKey01", "value": "This is an object store test" }' ""

Change APPLICATION_NAME to the name you chose when you deployed your application. Each time you submit this command, change the key’s name so that each key is unique.

Viewing Data in the Object Store

To view data in the Object Store:

  1. Log into Anypoint Platform and click Runtime Manager.

  2. Click the name of your application to view the application’s dashboard.

  3. Click Object Store from the left navigation bar:


    The Object Store user interface appears as follows:


  4. Click the Object Store name. You can click a key name to view its value.

  5. You can delete keys by clicking the Key down-arrow symbol: