DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Trending

  • Engineering Closed-Loop Graph-RAG Systems, Part 3: Closing the Loop in Graph-RAG Systems
  • Detecting Plan Regression in SQL Server Using Query Store
  • Testing AI-Infused Apps: A Dual-Layer Framework for AI Quality Assurance
  • Identity in Action

How to Use ObjectStore in Mule

A developer provides a quick and easy tutorial on how to work with ObjectStore from your Mule palette to create persistent data.

By 
Prince Pratap Singh user avatar
Prince Pratap Singh
·
Dec. 30, 20 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
28.9K Views

Join the DZone community and get the full member experience.

Join For Free

1. Introduction 

Object stores are used to store an object. Mule uses object stores whenever it needs to persist data  for later retrieval. Mule uses object stores internally by utilizing a key value pair combination. It is already available in the Mule palette – from there we can directly use it. If it is not available in your Mule palette, you can get it from the Mule Exchange Portal.

2. Operations Available 

An object store contains the following operations in the form of connectors in the Mule palette:

  • Clear: Removes all the contents in the store.
  • Contains: Returns whether the key is present or not.
  • Remove: Removes the values associated to the given key.
  • Retrieve: Retrieves the stored data for the given key.
  • Retrieve all: Retrieves all the key value pairs in the ObjectStore.
  • Retrieve all keys: Returns a List containing all keys that the ObjectStore currently holds.
  • Store: Stores the given value using the given key.

3. Types of ObjectStore

  • Persistent: This is the default option for the ObjectStore. By using this option, stored data stays in the system even if the system or its runtime is down.
  • In-Memory: Though this functionality is not available explicitly, it can be selected. By not selecting the persistent option, ObjectStore, by default, becomes in-memory. This means that data is available only when the runtime is up.

4. Implementing a Demo ObjectStore (Storing and Retrieval)

Store

  1. Drag and drop the ObjectStore: Storeconnector from the Mule Palette. 
  2. Configure the connector properties as per the screenshot below. 
  3. Create global configurations as per the screenshot below
  4. Click Ok and your ObjectStore: Store connector is ready!

Retrieve

  1. Drag and drop the ObjectStore: Retrieve connector from the Mule palette.
  2. Retrieve the data from ObjectStore by using a key.
  3. Check that the data is using a set payload or logger.
  4. Testing: Hit API.
ObjectStore

Opinions expressed by DZone contributors are their own.

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook