Tutorial: Object Store v2

This document helps you use Object Store v2 (OSv2) to store and view data. This tutorial works with Studio 6 using Mule 3.


This document assumes you are familiar with Anypoint Studio, using curl from a command line, and the use of Anypoint Platform and Runtime Manager. For more resources, view the See Also section of this document.

To Install the Object Store Connector

  1. In Anypoint Studio, click the Exchange icon in the Studio task bar.

  2. Click Login in Anypoint Exchange.

  3. Search for the ObjectStore connector and click Install.

  4. Follow the prompts to install the connector.

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 name. Each name is unique and becomes the URL by which your application is available in Runtime Manager. The URL has the format where your application resides in the name space. Ensure the application name gets a green check mark for proper naming and being unique.

    If you see this message: "You do not have permission to deploy new applications in this environment. Please select an existing application to redeploy", click the environment button in the upper left of the Runtime Manager display to change environments from a Design environment to a Production environment.

  5. Set the Runtime Version. Ensure that the Runtime exposes the Use Object Store v2 checkbox.

  6. Click the Use Object Store v2 checkbox.


  7. After configuring your application, click Deploy Application.

  8. In the Runtime Manager deploy window, wait until a message displays with a green dot and the message that your application successfully deployed to CloudHub.

  9. Click Open in Browser and Close Window.

  10. In Runtime Manager, click the right side of your application’s entry to view its details.

  11. Click Manage Application. In the application’s settings screen, note that Object Store appears in the left side navigation area. The former label Application Data is now called Object Store for OSv2.

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. To delete a key, hover over a key name, and click the trash can icon.