Generic module for accessing Object Stores.
This can be used with Mule default implementations or one can be passed via ref. It allows to store, retrieve and remove objects from the store.
Additional Info
Requires Mule Enterprise License |
Yes |
Requires Entitlement |
No |
Mule Version |
3.6.0 or higher |
Configs
Connector
<objectstore:config>
Configuration
Object Store Global configuration settings.
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
name |
The name of this configuration. With this name can be later referenced. |
x |
||
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) |
|
||
persistent |
boolean |
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) |
false |
|
objectStore |
ObjectStore<Serializable> |
Reference to an Object Store bean. This is optional and if it is not specified then the default in-memory or persistent store will be used. |
|
|
entryTtl |
TimeToLive for stored values in milliseconds. MaxEntries and ExpirationInterval are mandatory for using this param. Valid values: 0 for never expire, values greater than 0 are expiry in milliseconds. |
|
||
maxEntries |
Specifies the max number of entries. EntryTTL and ExpirationInterval are mandatory for using this param. |
|
||
expirationInterval |
Specifies the expiration check interval in milliseconds. EntryTTL and MaxEntries are mandatory for using this param. |
|
Processors
Contains
<objectstore:contains>
Checks whether the object store contains the given key.
XML Sample
<objectstore:contains key="MUL0001" config-ref="config-name"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to validate. |
x |
Returns
Return Java Type | Description |
---|---|
boolean |
true if the object store contains the key, or false if it doesn't. |
Dual store
<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 Goldie]" config-ref="config-name"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to store. |
x |
||
value |
The object to store. If you want this to be the payload then use value-ref="#[payload]". |
x |
||
overwrite |
boolean |
True if you want to overwrite the existing object. |
false |
|
Remove
<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"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to remove. |
x |
||
ignoreNotExists |
boolean |
Indicates if the operation will ignore NotExistsException from ObjectStore. |
false |
|
Returns
Return 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 will return a null object. |
Retrieve
<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"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to retrieve. |
x |
||
defaultValue |
The default value if the key does not exist. |
|
||
targetProperty |
The Mule Message property where the retrieved value will be stored. |
|
||
targetScope |
The Mule Message property scope, only used when targetProperty is specified. |
INVOCATION |
|
Returns
Return 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
<objectstore:retrieve-all-keys>
Returns a list of all the keys in the object store.
IMPORTANT: Not all stores support this method. If the method is not supported a java.lang.UnsupportedOperationException is thrown
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
Retrieve and store
<objectstore:retrieve-and-store>
Retrieve and Store in the same operation.
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to retrieve. |
x |
||
defaultValue |
The default value if the key does not exist. |
|
||
storeValue |
The object to store. If you want this to be the payload then use value-ref="#[payload]". |
x |
||
targetProperty |
The Mule Message property where the retrieved value will be stored. |
|
||
targetScope |
The Mule Message property scope, only used when targetProperty is specified. |
INVOCATION |
|
Returns
Return Java Type | Description |
---|---|
The object associated with the given key. If no object for the given key was found this method returns the defaultValue. |
Store
<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"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
key |
The identifier of the object to store. |
x |
||
value |
The object to store. If you want this to be the payload then use value-ref="#[payload]". |
x |
||
overwrite |
boolean |
True if you want to overwrite the existing object. |
false |
|
Dispose store
<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.