Nav

Object Store

Object Store v2 lets you share data and states across batch processes, Mule components, and multiple distributed applications. You can also use object store as a distributed object store for advanced use cases such as API caching and API rate limiting.

Note: To use Object Store v2, you must have an entitlement for this product. Contact your MuleSoft Sales rep for more information.

Components

Anypoint Object Store consists of these components:

  • Object Store Connector - Use with Anypoint Studio to construct flows to write to and read from the object store. You can install the Object Store connector using Anypoint Exchange from within Anypoint Studio. After installed, search Studio for "objectstore". The Object Store connector works with both Object Store version 1 and version 2. Use Studio to create an application that you deploy to Runtime Manager where the application runs and serves requests to read to and write from the object store.

  • REST API - Lets you create and delete objects, set TTL (time to live) for objects, and set usage limits.

  • Runtime Manager > Object Store user interface - When you enable object store, the Runtime Manager > Application Data setting changes its label to Object Store. From the object store interface, you can administer objects and their values in the object store. The interface also lets you delete object store objects.

To Download and Install the Object Store Connector

  1. Open Anypoint Studio.

  2. Click the Anypoint Exchange icon in the Studio taskbar:

    osv2-exchange-x

  3. When the Exchange window opens, install the Object Store connector.

To Use Object Store Connector in an Application

Anypoint Studio is used to assemble the elements of your application and to test run it to ensure the application works. After you ensure your application works, you can use Studio to upload your application to the Anypoint Platform cloud environment where you can deploy the application. To send content to the object store, you can use a program such as Postman.

Note: If you are starting with Anypoint Studio, refer to Create an Object Store Application in Anypoint Studio.

  1. In Anypoint Studio, click File > New > Mule Project.

  2. Create a simple flow such as the following:

    Building Block

    Parameters

    HTTP connector

    Host = All interfaces [0.0.0.0] (Default)
    Port = 8081
    Path = /store
    Allowed Methods = POST

    Object to String

    No settings (use defaults)

    JSON to Object

    Return Class = java.util.Map

    Object Store
    (objectstore) connector

    Key = #[payload.key]
    Value Reference = #[payload.value]

    Set Payload

    Settings = KEY: #[payload.key] AND VALUE: #[payload.value] WERE SAVED OK

    When done, the flow appears as:

    osv2-studio-flow

  3. Save the application. Test run the application so you know it works. Right-click the canvas and click Run project <name>. If the application starts successfully, you can stop it. Right-click the canvas and click Stop project <name>.

  4. Right-click your application’s name in Anypoint Studio’s Package Explorer and click Anypoint Platform > Deploy to Cloud.

  5. 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.

  6. In Runtime Manager:

    • Give the application a name. Each name is unique and becomes the URL under which your application is stored in Runtime Manager. The URL is in the form <application_name>.cloudhub.io. Ensure the application name gets a green checkmark for proper naming and being unique.

    • Set the Runtime version to a version with OBJECT-STORE in the runtime name.

    • Click the Use Object Store v2 checkbox.

      osv2-runtime_manager_deploy_app

  7. After configuring your application, click Deploy Application.

  8. Runtime Manager prompts you to ensure you want to make this choice.

  9. Start your application.

When you choose a Runtime Version containing OBJECT-STORE in the version name, the Application Data label in the Runtime Manager navigation bar on the left side of the screen changes to Object Store.

To Send 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.

If you use Windows, you can get an add-on curl command from:

For other operating systems, curl.haxx.se supports dozens more systems. In addition, you can get curl add-ins for the Chrome browser.

Mac/Linux command line:

curl -X POST -H "Content-Type: application/json" -d '{ "key": "TestKey01", "value": "This is an object store test" }' "http://<application_name>.cloudhub.io/store"

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.

To View 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:

    osv2-in-nav-bar

    The Object Store user interface appears as follows:

    osv2-ui

    In the Beta release:

    • The Object Store name is DEFAULT_USER_STORE.

    • The time to live (TTL) value is set at 14 days (1209600 seconds).

  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:

    osv2-delete-keys