Contact Free trial Login

Use Object Store v2

Anypoint Object Store v2 (Object Store v2) enables you to share data and states across Mule runtime workers within a single application.

Object Store v2 is enabled by default in Mule 4 and in Anypoint Platform EU Control Plane. In Mule 3, enable Object Store v2 from Anypoint Platform > Runtime Manager for applications that you want to access Object Store v2.


Object Store v2 interacts with these components:

  • Anypoint Connector for Object Store (Object Store Connector)

    Use Object Store Connector with Anypoint Studio to construct flows to write to and read from the object store.

    Object Store Connector works with both Object Store version 1 and version 2.

    To use Object Store v2 with Mule 4 apps, do not select an object store global element from the Object store menu. If you select the object store global element, the app uses the Mule runtime object store, rather than Object Store v2.


    The Object Store v2 API enables you to create and delete objects, set TTL (time to live) for objects, and set usage limits.

    The Object Store v2 Stats API enables you to retrieve Object Store v2 usage statistics, such as how many API calls per month your organization makes to Object Store.

  • Anypoint Runtime Manager

    When you enable Object Store v2, the Runtime Manager > Application Data option changes to Object Store. From the Object Store page, you can manage objects and their values in the object store.

Protect Object Store Data

Object Store v2 uses TLS for secure transport. Data at rest is stored using FIPS 140-2-compliant encryption standards. If you require a higher level of security, encrypt sensitive data before writing it to the object store.

Add Object Store Connector to Your Mule 4 Project

Install Object Store Connector to add it to a Mule project:

  1. In Studio, create a Mule project.

  2. In the Mule Palette view, click (X) Search in Exchange.

  3. In Add Dependencies to Project, enter Object Store in the search field.

  4. In Available modules, click ObjectStore Connector - Mule 4 and click Add.

  5. Click Finish.

Use Object Store Connector in an Application

  1. In Studio, create a simple flow such as the following:

    Listener and Store operations in Studio
    Figure 1. The screenshot shows (1) the Listener operation and (2) the Store operation in the os-Simple-Flow flow.



    HTTP Listener

    Connector configuration = HTTP_Listener_config Path = /store

    Object Store

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

  2. Save the application.

  3. Right-click the application name in Package Explorer and select Anypoint Platform > Deploy to CloudHub.

  4. If prompted, sign in to Anypoint Platform.

  5. Click Deploy Application and click Open in Browser.

  6. In Runtime Manager, click the Status column for your application.

  7. In the details pane, copy the App url address.

Send Data to an Object Store

From a command line prompt, send JSON data to your Mule application using a curl command:

curl -X POST -H "Content-Type: application/json" -d '{ "key": "TestKey01", "value": "Testing" }' "http://app-url/store"

Change app-url to the name you copied from App url in Runtime Manager.

View Data in an Object Store

To view data in an object store:

  1. In Runtime Manager, click the name of your application to view the dashboard.

  2. Click Object Store in the left navigation pane.

  3. Click the object store, the partition, and then the key:

    Object Store option
    Figure 2. The screenshot shows (1) the object store, (2) the key, and (3) the value in the object store.

    The columns show the object store name, partition name, key, and key data. The partition groups the object store keys.

    The TestKey01 key that you sent from curl appears in the object store with the value [binary value] BINARY. The value is binary because Mule 4 wraps values in a Mule object, which causes them to be visible only as binary in Anypoint Platform.

  4. To delete a key, hover over a key name and click the trash can icon.

    Similarly, you can delete a partition or the store itself by hovering over and clicking the trash can icon.

The tutorial provides more detailed information about creating object stores in Mule 3 and Mule 4 applications.

Configure a Custom Time to Live Period

To configure a custom time to live (TTL) period for keys stored in Object Store v2:

  1. Create an app that uses Mule runtime engine version 4.2.1 or later.

  2. Configure the object store in the app.

  3. Select the Store operation in the flow and, in the properties window, click the green plus icon (+) to the right of the Object store field:

    Green plus icon in the properties window
    Figure 3. The arrow shows the green plus icon in the properties window.
  4. Configure the TTL entries in the Global Object Store Configuration window:

    Global Object Store Configuration window
    Figure 4. The arrow indicates the Entry ttl field in the Global Object Store Configuration window.
    For Object Store v2, the Max entries field is not configurable.
    • Entry ttl

      For Mule 4.2.1 and later, enter a custom TTL value of 0 through 2592000 seconds (30 days).

      If you leave this field empty, you enable rolling TTL; if you exceed 2592000 seconds, the TTL defaults to 2592000 seconds.

      For Mule versions earlier than 4.2.1, leaving this field empty to set the TTL to 2592000 seconds.

    • Entry ttl unit

      Specify the TTL time interval, such as MINUTES.

    • Expiration interval

      Specify how frequently to run the expiration thread.

      Set this parameter to a positive value that is less than the Entry ttl value. If this field is blank or the value is less than or equal to zero, Object Store v2 ignores Entry ttl.

    • Expiration interval unit

      Specify the expiration interval time unit, such as MINUTES.

  5. Click OK to dismiss the window.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub