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

String

The name of this configuration. With this name can be later referenced.

x 

partition

String

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

Integer

TimeToLive for stored values in milliseconds. MaxEntries and ExpirationInterval are mandatory for using this param.

 

maxEntries

Integer

Specifies the max number of entries. EntryTTL and ExpirationInterval are mandatory for using this param.

 

expirationInterval

Integer

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

String

Specify which config to use

x 

key

String

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

String

Specify which config to use

x 

key

String

The identifier of the object to store.

x 

value

Serializable

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

String

Specify which config to use

x 

key

String

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

Serializable

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

String

Specify which config to use

x 

key

String

The identifier of the object to retrieve.

x 

defaultValue

Serializable

The default value if the key does not exist.

 

targetProperty

String

The Mule Message property where the retrieved value will be stored.

 

targetScope

MulePropertyScope

The Mule Message property scope, only used when targetProperty is specified.

INVOCATION

 

Returns

Return Java Type Description

Serializable

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

String

Specify which config to use

x 

Returns

Return Java Type Description

List<String>

a java.util.List with all the keys in the store.


Retrieve and store

<objectstore:retrieve-and-store>

Retrieve and Store in the same operation.

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

key

String

The identifier of the object to retrieve.

x 

defaultValue

Serializable

The default value if the key does not exist.

 

storeValue

Serializable

The object to store. If you want this to be the payload then use value-ref="#[payload]".

x 

targetProperty

String

The Mule Message property where the retrieved value will be stored.

 

targetScope

MulePropertyScope

The Mule Message property scope, only used when targetProperty is specified.

INVOCATION

 

Returns

Return Java Type Description

Serializable

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

String

Specify which config to use

x 

key

String

The identifier of the object to store.

x 

value

Serializable

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