xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
Object Store Connector - Mule 3
Object Store Connector Version 2.2
Anypoint Connector for Object Store (Object Store Connector) enables you to connect to the Mule 3 object storage facility and exposes convenient methods for exploiting the capabilities of Mule object stores. Internally, Mule uses object stores in various filters, routers, and other message processors to Store state between messages. Object Store Connector works with the object store through references. Any transformations a user applies to an object store using the connector propagate to all references of that object store.
Release Notes: Object Store Connector Release Notes
Before You Begin
This document assumes that you are familiar with Mule, Anypoint Studio, global elements, and DataSense.
Note: ObjectStore does not support TTL in its default configuration.
Namespace and Schema
When designing your application in Studio, the act of dragging the connector from the palette onto the Anypoint Studio canvas should automatically populate the XML code with the connector namespace and schema location.
Schema Location
http://www.mulesoft.org/schema/mule/object/current/mule-objectstore.xsd
For example, include the connector namespace and schema location in the XML for your application:
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/objectstore
http://www.mulesoft.org/schema/mule/objectstore/current/mule-objectstore.xsd">
<!-- Insert your configuration elements and your flow here -->
</mule>
Compatibility
The Object Store connector is compatible with:
Application/Service | Version |
---|---|
Mule Runtime |
3.6.0 and later |
Anypoint Studio |
5.2 and later |
Starting with version 2.0.0, the Object Store connector is licensed commercially with Anypoint Platform as with other Select connectors.
Object Store Types
On-premises:
-
In memory: Content is only stored in memory. If the runtime goes down, you lose your data.
-
Persistent: If a cluster is not running, object store data is stored on disk. If a cluster is running, data is stored in the shared memory grid. If Mule runtime engine restarts, the object store content persists.
-
Shared: If a cluster is running, the content of the object store persists across cluster nodes. When a new node spins up, it has access to the existing object store content.
-
External OS implementation: Allows you to use an external implementation as the backend for the object store. Examples include a MySQL database or Redis.
On CloudHub:
-
In memory: Object store data is stored in the memory of the JVM, and when the Mule application stops or is redeployed, all the data is lost.
-
Persistent: Content is stored in an outside persistence layer and data survives runtime restarts or application redeployments. The outside persistence layer can be one of the following: Cloud Object Store v1 (CloudHub-managed MySQL database) or a cloud object store v2 (API service built on top of an AWS DynamoDB).
-
Shared: Mule workers in CloudHub are not in a cluster, therefore they do not share memory the same way as on-premises. However, if an application is configured to use Object Store v2, then the object store data is stored in the cloud and the data is shared across workers.
-
External OS implementation: This is the same as on-premises - allows you to use an external implementation as the backend for the object store. Examples include a MySQL database or Redis.
Install the Connector
-
In Anypoint Studio, click the Exchange icon in the Studio taskbar.
-
Sign in to Exchange with your Anypoint Platform credentials.
-
From Anypoint Exchange, click Provided by MuleSoft.
-
Search for the Mule 3 connector and click Install.
Object Store Spring Bean Instances
By default, Mule includes three default object stores instantiated every time you run Mule both on premises and on Runtime Manager.
Each Mule runtime includes these three spring bean instances:
-
_defaultInMemoryObjectStore
-
_defaultUserObjectStore
-
_defaultTransientUserObjectStore
You can also code your own object store Java class, then include an instance in your application as a Spring bean. You can then reference your custom object store when you define a new Object Store global element.
Object Store version 2 overrides the _defaultUserObjectStore
object store. See Object Store v2.
Persist Object Stores in Runtime Manager
The persistent option persists data in on premises applications; however to persist data in Runtime Manager’s Application Data user interface, you need to use the _defaultUserObjectStore
spring bean instance in your Object Store configuration.
The _defaultUserObjectStore
spring bean instance ensures that an Object Store in a Runtime Manager application survives across redeployments. When you use this bean instance, data persists outside the Runtime Manager worker (but in the cloud), which is why the data is available after restarts.
Reference the Spring bean instance using the Object Store Reference field.
The _defaultUserObjectStore
parameter is declared as follows in XML:
<objectstore:config ... objectStore-ref="_defaultUserObjectStore" .../>
Note: objectStore-ref
is not required for Object Store v1, but is required for Object Store v2. objectStore-ref="_defaultUserObjectStore"
must be declared to ensure data is stored in OSv2. If not specified, the data stays in-memory on the Mule worker and vanishes on a restart or other such event.
The Persistent option is declared as follows in XML:
<objectstore:config ... persistent="true"/>
Set up the Global Configuration Using Studio Visual Editor
Configure a global Object Store element to use by all instances of the Object Store connector in your application.
-
Click the Global Elements tab at the base of the canvas.
-
On the Global Mule Configuration Elements screen, click Create.
-
In the Choose Global Type wizard, expand Connector Configuration and select ObjectStore: Configuration and click OK.
-
Configure the parameters according to your needs. This is the screen you configure the connector global element from:
Parameter Description Name
(Required) Enter a name for the configuration to reference it.
Partition
Name of the partition. If set, and a partitionable object store is specified in the objectStore-ref attribute, the partition name is used. Otherwise, the partition name is ignored.
This means that:
-
If you define an objectStore-ref and the object store is partitionable, the connector uses the partition name.
-
If you define an objectStore-ref and the object store is NOT partitionable, the connector ignores the partition name.
-
If you don’t define an objectStore-ref, but supply a partition name, the connector applies the partition name to the default object store.
Object Store Reference
Specify the Object Store spring bean instance. This is optional and if not specified, the default in-memory or persistent store is used. See Object Store Spring Bean Instances.
Note: Object Store Reference is not required for Object Store v1, but is required for Object Store v2. For OSv2, the Object Store Reference must be set to _defaultUserObjectStore to ensure data is stored in OSv2. If not specified, the data stays in-memory on the Mule worker and vanishes on a restart or other such event.
Entry Ttl
TimeToLive for stored values in milliseconds. "Max Entries" and "Expiration Interval" are mandatory for using this param. You must either provide all Entry TTL, Max Entries, and Expiration Interval, or none of them. If you don’t specify a value, the default TTL is 30 days. Because this field is an integer, the maximum value you can set in this field is 24 days (2,147,483,647 milliseconds). The Object Store v2 REST API lets you set a TTL of up to 30 days.
Updating the data (for example, by overwriting the key) resets the TTL. For information about TTL behavior, see How long can data persist in Object Store v2?.
Expiration Interval
Specifies the expiration check interval in milliseconds.
Max Entries
Specifies the maximum number of entries allowed. The Entry TTL and Expiration Interval attributes are required when using this parameter. Exceeding entries are removed when the expiration thread runs. Valid values: 0 for unlimited, values greater than 0 are the maximum number of entries.
Persistent
Specified whenever the required store needs to be persistent or not. See Persist Object Stores in Runtime Manager.
Note: In the image above, the placeholder values refer to a configuration file placed in the
src
folder of your project. See Learn How to Configure Properties.You can either enter your credentials into the global configuration properties, or reference a configuration file that contains these values. For simpler maintenance and better re-usability of your project, Mule recommends that you use a configuration file. Keeping these values in a separate file is useful if you need to deploy to different environments, such as production, development, and QA, where your access credentials differ.
-
-
Click OK to save the global connector configurations.
Set Up the Global Configuration Using XML
Follow these steps to configure the connector in your application: Create a global Object Store configuration outside and above your flows, using the following global configuration code.
<objectstore:config
name="ObjectStore__Configuration"
partition="${objectstore.partition.counter}"
doc:name="ObjectStore: Configuration"/>
When you manually code the Mule application in Studio’s XML editor or another text editor, paste these into the header of your Configuration XML inside the <mule> tag as in the example below.
|
Name | Description |
---|---|
name |
The identifier of the object store configuration. Other components must reference this configuration via this name. Studio Field: Name |
doc:name |
The string displayed in Anypoint Studio. Studio Field: Name |
partition |
Name of the partition. If set, and a partitionable object store is specified in the objectStore-ref attribute, the partition name is used. Otherwise, the partition name is ignored. This means that:
Studio Field: Partition |
objectStore-ref |
Optional. Reference to an object store spring bean instance. Use an instance depending on the context (stand-alone Mule runtime, Mule runtime cluster, or CloudHub cluster). You can also specify one of the default object stores by name Note: objectStore-ref is not required for Object Store v1, but is required for Object Store v2. Studio Field: Object Store Reference |
entryTtl |
Time To Live for stored values in milliseconds. If using this parameter, maxEntries, and expirationInterval are mandatory. The default value is 14 days. The maximum value you can set in this field is 24 days (2,147,483,647 milliseconds). Note: The Object Store v2 REST API, lets you set a TTL of up to 30 days. Studio Field: Entry Ttl |
expirationInterval |
Specifies the expiration check interval in milliseconds. Studio Field: Expiration Interval |
maxEntries |
Specifies the maximum number of entries allowed. The Entry TTL and Expiration Interval attributes are required when using this parameter. Exceeding entries are removed when the expiration thread runs. Valid values: 0 for unlimited, values greater than 0 are the maximum number of entries. Studio Field: Max Entries |
Specifies if the required store needs to be
persistent or not (this argument is ignored if the
object store is passed by reference using the objectStore-ref attribute,
or if no partition name is defined).
If persistent is Studio Field: Persistent (checkbox) |
The following is an example objectstore configuration that specifies a partition named customers
within the defaultUserObjectStore
, and specifying that the object store should be persistent.
<objectstore:config ... partition="customer" persistent="true"/>
If you do not specify a value for the objectStore-ref, the _defaultUserObjectStore
is used, which is equivalent to this configuration:
<objectstore:config name="ObjectStore__Configuration"
objectStore-ref="_defaultUserObjectStore" persistent="true"/>
If you don’t want to use one of the default object stores, you can define your own Java bean and reference it instead in the objectStore-ref attribute.
Update from an Older Version
If you’re currently using an older version of the connector, a small popup appears in the bottom right corner of Anypoint Studio with an "Updates Available" message.
-
Click the popup and check for available updates.
-
Click the Object Store connector checkbox for the version you require and click Next, following the instructions provided by the user interface.
-
Restart Studio when prompted.
-
After restarting, when creating a flow and using the Object Store connector, if you have several versions of the connector installed, you may be asked which version you would like to use. Choose the version you would like to use.
We recommend that you keep Studio up to date with its latest version.
Use This Connector
The Object Store connector is an operation-based connector, which means that when you add the connector to your flow, you need to configure a specific operation for the connector to perform. See the entire operation processors list in the github.io or click individually on the listed operations below. The connector currently supports the following list of operations, each requiring certain attributes to be set:
The Dual store operation may be misleading. The function of this operation is to do two writes to the object store, the first with objectStore.store(key, value) and the second with the objectStore.store(value, key) operation.
|
Add to a Flow
-
Create a new Mule Project in Anypoint Studio.
-
Add a suitable Mule Inbound Endpoint, such as the HTTP listener or File endpoint, to begin the flow.
-
Drag the Object Store connector onto the canvas.
-
Click on the connector component to open the Properties Editor.
-
Configure the following parameters:
Field Description Basic Settings:
Display Name
Enter a unique label for the connector in your application.
Connector Configuration
Connect to a global element linked to this connector. Global elements encapsulate reusable data about the connection to the target resource or service. Select the global Object Store connector element that you just created.
Operation
Select Store from the drop-down menu.
General:
Key
The identifier of the object to store.
Value Reference
The object to store.
-
Save your configurations.
Example Use Case
After installing and configuring the Object Store connector, use it in a Mule flow to store and retrieve employee data.
The following Mule app stores employee data containing employee identifier, first name, last name and age in JSON format using the Object Store connector. The Mule app has two HTTP endpoints.
-
/store
: Used to store employee data -
/retrieve
: Get employee data for the identifier mentioned.
Store Employee Data
-
Create a new Mule project in Anypoint Studio.
-
Drag an HTTP connector onto the canvas and configure the following parameters:
Parameter Value Display Name
HTTP
Connector Configuration
If no HTTP element has been created yet, click the plus sign to add a new HTTP Listener Configuration and click OK (leave the values to its defaults).
Path
/store
-
Drag a Transform Message component onto the canvas and paste the following code:
%dw 1.0 %output application/json --- { id: inboundProperties.'http.query.params'.id, name: inboundProperties.'http.query.params'.name, lname: inboundProperties.'http.query.params'.lname, age: inboundProperties.'http.query.params'.age }
-
Drag an Object to Byte Array component to the right of the Transform Message component.
-
Drag an Object Store connector next to the Object to Byte Array component and configure the following:
-
Click the plus icon (+) to the right of the Connector Configuration field to add a new Object Store Global Element.
-
Configure the global element with these parameters:
Parameter Description Value Name
Enter a name for the configuration to reference it.
<Configuration_Name>
Partition
Name of the partition
employees
-
Verify that the XML configuration looks like the following:
<objectstore:config name="ObjectStore__Configuration" partition="employees" doc:name="ObjectStore: Configuration"/>
-
In the Properties pane of the Object Store connector, configure these parameters:
Parameter Value Basic Settings:
Display Name
Store employee (or any other name you prefer).
Connector Configuration
ObjectStore__Configuration (the reference name to the global element you have created).
Operation
Store
General:
Key
#[message.inboundProperties.'http.query.params'.id]
Value Reference
#[payload]
-
Verify that the XML looks like the following:
<objectstore:store config-ref="ObjectStore__Configuration" key="#[message.inboundProperties.'http.query.params'.id]" value-ref="#[payload]" doc:name="Store employee"/>
-
-
Drag another Object Store connector to get all keys from Store.
-
In the Properties pane of the Object Store connector, configure these parameters:
Parameter Value Basic Settings:
Display Name
Get all keys (or any other name you prefer).
Connector Configuration
ObjectStore__Configuration (the reference name to the global element you have created).
Operation
All keys
-
Verify that the XML looks like the following:
<objectstore:retrieve-all-keys config-ref="ObjectStore__Configuration" doc:name="Get all keys"/>
-
-
Drag a Logger scope after the Object Store connector to print the data that is being passed by the All keys operation in the Mule console.
-
Configure the Logger with the following parameters:
Parameter Value Display Name
Log Employee IDs (or any other name you prefer)
Message
Keys :
#[payload]
Level
INFO
-
Drag a Set Payload after the logger component.
-
Configure the component with the following parameters.
Parameter Value Display Name
Show Employee IDs (or any other name you prefer)
Message
Keys :
#[payload]
Level
INFO
Retrieve Employee Data
-
Add another flow to retrieve employee data stored previously.
-
Drag a Flow Component below the above flow.
-
Drag a HTTP connector onto the canvas and configure the following parameters:
Parameter Value Display Name
HTTP
Connector Configuration
Use the already available configuration .
Path
/retrieve
-
Drag the Object Store connector and configure it according to the steps below:
Parameter Value Basic Settings:
Display Name
Store employee (or any other name you prefer).
Connector Configuration
ObjectStore__Configuration (the reference name to the global element you have created).
Operation
Retrieve
General:
Key
#[message.inboundProperties.'http.query.params'.id]
-
Check that your XML looks as follows:
<objectstore:retrieve config-ref="ObjectStore__Configuration" key="#[message.inboundProperties.'http.query.params'.id]" doc:name="Retrieve Employee"/>
-
Add a Logger scope after the Object Store connector to print the data that is being retrieved in the previous operation to the Mule Console. Configure the Logger according to the table below.
Parameter Value Display Name
Log Employee data (or any other name you prefer)
Message
Keys :
#[payload]
Level
INFO
-
Add a Set Payload after the logger component. Configure the component according to the table below.
Parameter Value Display Name
Show Employee data (or any other name you prefer)
Message
Keys :
#[payload]
Level
INFO
Example XML Code
Paste this code into your XML Editor to quickly load the flow for this example use case into your Mule application.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/objectstore
http://www.mulesoft.org/schema/mule/objectstore/current/mule-objectstore.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration"
host="0.0.0.0"
port="8081" doc:name="HTTP Listener Configuration"/>
<objectstore:config name="ObjectStore__Connector"
partition="employees" doc:name="ObjectStore: Connector"/>
<flow name="objectstore-store-employee-flow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/store" doc:name="HTTP"/>
<dw:transform-message doc:name="Transform Message" metadata:id="956c4ffe-8e25-4c9e-a47d-944d715146e1">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
id: inboundProperties.'http.query.params'.id,
name: inboundProperties.'http.query.params'.name,
lname: inboundProperties.'http.query.params'.lname,
age: inboundProperties.'http.query.params'.age
}]]></dw:set-payload>
</dw:transform-message>
<object-to-byte-array-transformer doc:name="Object to Byte Array"/>
<objectstore:store config-ref="ObjectStore__Connector"
key="#[message.inboundProperties.'http.query.params'.id]"
value-ref="#[payload]" doc:name="Store employee"/>
<objectstore:retrieve-all-keys config-ref="ObjectStore__Connector"
doc:name="Get all keys"/>
<logger level="INFO" doc:name="Log Employee Id's" message="Keys : #[payload]" />
<set-payload value="Keys : #[payload]" doc:name="Show Employee Id's"/>
</flow>
<flow name="objectstore-retrieve-employee-flow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/retrieve" doc:name="HTTP"/>
<objectstore:retrieve config-ref="ObjectStore__Connector"
key="#[message.inboundProperties.'http.query.params'.id]"
doc:name="Retrieve Employee"/>
<byte-array-to-object-transformer doc:name="Byte Array to Object"/>
<logger message="Employee: #[payload]" level="INFO" doc:name="Log Employee"/>
<set-payload value="Employee : #[payload]" doc:name="Show Employee"/>
</flow>
</mule>
Run Time
-
Save and run the project as a Mule Application.
-
Open a web browser and enter the below to check the response.
To store a employee record enter the URL:
http://localhost:8081/store?id=1&name=David&lname=Malhar&age=10
.To retrieve a employee record enter the URL:
http://localhost:8081/retrieve?id=1
The logger displays the employee record in JSON format in the browser.
-
The object store throws an exception when an attempt is made to overwrite an existing key; this is expected behavior. The object store throws an exception when an attempt to read is made using a key that does not exist in the object store; this too is expected behavior.
-
This example uses a simple in-memory store; to clear the contents of this store, restart Mule runtime.
Use the Connector in a Mavenized Mule App
If you are coding a Mavenized Mule application, this XML snippet must be included in your pom.xml
file.
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-objectstore</artifactId>
<version>x.x.x</version>
</dependency>
Inside the <version>
tags, put the desired version number, the word RELEASE
for the latest release, or SNAPSHOT
for the latest available version. See the Exchange Object Store connector for specific versions.
Object Store Connector Reference
Generic module for accessing Object Stores.
See also the Object Store Technical Reference.
This can be used with Mule default implementations or one can be passed via a reference. This connector allows you to store, retrieve, and remove objects from the store.
Additional Info:
-
Requires Mule Enterprise License
-
Does not require an entitlement
-
Mule Version: 3.6.0 or higher
Connector Configuration
<objectstore:config>
Configuration Object Store global configuration settings.
Attribute | Description |
---|---|
name |
The name of this configuration for later reference. Type: String |
partition |
Name of the partition in the default in-memory or persistent object stores (this argument has no meaning if the object store is passed by ref using objectStore-ref). This means that:
Type: String |
persistent |
Specified whenever the required store needs to be persistent or not (this argument has no meaning if the object store is passed by ref using objectStore-ref or no partition name is defined). Type: Boolean |
objectStore |
Reference to an Object Store bean. This is optional and if it is not specified, the default in-memory or persistent store is used. Type: ObjectStore<Serializable> |
entryTtl |
Time to live for stored values in milliseconds. The maxEntries and expirationInterval attributes are required when using this parameter. Valid values: 0 for never expires, values greater than 0 expire in milliseconds. Type: Integer |
maxEntries |
Specifies the maximum number of entries. The entryTTL and expirationInterval attributes are required when using this parameter. Valid values: 0 for unlimited, values greater than 0 are the maximum number of entries - after this number an exception is thrown. Type: Integer |
expirationInterval |
Specifies the expiration check interval in milliseconds. The entryTTL and maxEntries attributes are required when using this parameter. Type: Integer |
Contains Processor
<objectstore:contains>
Checks whether the object store contains the given key.
XML Sample:
<objectstore:contains key="MUL0001" config-ref="config-name"/>
Attribute | Description |
---|---|
config-ref |
Specifies which configuration to use. Type: String |
key |
The identifier of the object to validate. Type: String |
Returns:
Java Type | Description |
---|---|
Boolean |
True if the object store contains the key, or false if it doesn’t. |
Dispose Store Processor
<objectstore:dispose-store>
Removes a given partition without disposing the entirely Object Store. Whether using a persistent store or not, internally, this operation performs a clear() of the items, so a user should still be able perform other operations. For persistent stores, this operation only deletes the contents of the folder but not the folder itself.
Object Store versions earlier than 3.6 don’t release resources after the Dispose Store operation. To use the previous behavior, set the following property:
|
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
partitionName |
The name of the object store. Type: String |
Dual Store Processor
<objectstore:dual-store>
Stores a value using key and also stores a key using value. If an exception is thrown rolls back both operations. This allows an option to indicate if key would be overwritten or not.
XML Sample:
<objectstore:dual-store key="MUL0001" value-ref="#[string:Jason Goldfish]" config-ref="config-name"/>
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
key |
The identifier of the object to store. Type: String |
value |
The object to store. If you want this to be the payload, use Type: Serializable |
overwrite |
True if you want to overwrite the existing object. Type: Boolean |
Remove Processor
<objectstore:remove>
Remove the object for the respective key. This operation can fail silently based on the value passed in ignoreNotExists.
XML Sample:
<objectstore:remove key="MUL0001" config-ref="config-name"/>
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
key |
The identifier of the object to remove. Type: String |
ignoreNotExists |
Indicates whether or not the operation ignores NotExistsException from ObjectStore. Type: Boolean |
Returns:
Java Type | Description |
---|---|
The object that was previously stored for the given key. If the key does not exist and ignoreNotExists is true, the operation returns a null object. |
Retrieve Processor
<objectstore:retrieve>
Retrieve an object from the object store and make it available in the specified property scope of a Mule Message.
XML Sample:
<objectstore:retrieve key="MUL0001" defaultValue-ref="#[string:MuleSoft Employee]" config-ref="config-name"/>
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
key |
The identifier of the object to retrieve. Type: String |
defaultValue |
The default value if the key does not exist. Type: Serializable |
targetProperty |
The Mule Message property where the retrieved value is stored. Type: String |
targetScope |
The Mule Message property scope, only used when targetProperty is specified. Type: MulePropertyScope Enum |
Returns:
Java Type | Description |
---|---|
The object associated with the given key. If no object for the given key was found this method throws an ObjectDoesNotExistException. |
Retrieve All Keys Processor
<objectstore:retrieve-all-keys>
Returns a list of all the keys in the object store.
Not all stores support this method. If the method is not supported, a java.lang.UnsupportedOperationException is thrown. |
Attribute | Description |
---|---|
config-ref |
Specify which config to use. Type: String |
Returns:
Java Type | Description |
---|---|
|
A java.util.List with all the keys in the store. |
Retrieve and Store Processor
<objectstore:retrieve-and-store>
Retrieves and stores in the same operation.
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
key |
The identifier of the object to retrieve. Type: String |
defaultValue |
The default value if the key does not exist. Type: Serializable |
storeValue |
The object to store. If you want this to be the payload, use Type: Serializable |
targetProperty |
The Mule Message property where the retrieved value is stored. Type: String |
targetScope |
The Mule Message property scope, only used when targetProperty is specified. Type: MulePropertyScope Enum |
Returns:
Java Type | Description |
---|---|
The object associated with the given key. If no object for the given key was found this method throws an ObjectDoesNotExistException. |
Store Processor
<objectstore:store>
Stores an object in the object store. This allows an option to indicate if key would be overwritten or not.
XML Sample:
<objectstore:store key="MUL0001" value-ref="#[string:Jason Goldie]" config-ref="config-name"/>
Attribute | Description |
---|---|
config-ref |
Specifies with configuration to use. Type: String |
key |
The identifier of the object to store. Type: String |
value |
The object to store. If you want this to be the payload, use Type: Serializable |
overwrite |
True if you want to overwrite the existing object. Type: Boolean |
MulePropertyScope Enum
java.lang.Object
java.lang.Enum<MulePropertyScope>
org.mule.modules.objectstore.MulePropertyScope
All Implemented Interfaces:
Serializable, Comparable<MulePropertyScope>
public enum MulePropertyScope
extends Enum<MulePropertyScope>
Enum for Mule Property Scopes used for improving the user experience in Anypoint Studio.
Enum Constant Summary:
-
INBOUND
-
INVOCATION
-
OUTBOUND
-
SESSION
Method Summary:
Modifier and Type | Method and Description |
---|---|
String |
toString() |
String |
value() |
static MulePropertyScope |
valueOf(String name) Returns the enum constant of this type with the specified name. |
static MulePropertyScope[] |
values() Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum: clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
Enum Constant Detail:
Enum | Detail |
---|---|
INBOUND |
|
INVOCATION |
|
OUTBOUND |
|
SESSION |
|
Values Method Detail
public static MulePropertyScope[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MulePropertyScope c : MulePropertyScope.values())
System.out.println(c);
Returns:
An array containing the constants of this enum type, in the order they are declared.
valueOf Method Detail
public static MulePropertyScope valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. Extraneous whitespace characters are not permitted.
Parameters: name - The name of the enum constant to be returned.
Returns: The enum constant with the specified name.
Throws:
-
IllegalArgumentException - If this enum type has no constant with the specified name.
-
NullPointerException - If the argument is null.