org.mule.modules

mule-module-objectstore


Namespacehttp://www.mulesoft.org/schema/mule/objectstore
Schema Locationhttp://www.mulesoft.org/schema/mule/objectstore/current/mule-objectstore.xsd  (View Schema)
Schema Version1.0
Minimum Mule Version3.2

Module Overview

Generic module for accessing Object Stores.

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.

Summary

Configuration
<objectstore:config>
Configure an instance of this module
Message Processors
<objectstore:all-keys>
Returns a list of all the keys in the store.
<objectstore:dual-store>
Store value using key, and also store key using value.
<objectstore:remove>
Remove the object with key.
<objectstore:retrieve>
Retrieve the given Object.
<objectstore:store>
Store object

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<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">

      <!-- here goes your flows and configuration elements -->

</mule>

This module is configured using the config element. This element must be placed outside of your flows and at the root of your Mule application. You can create as many configurations as you deem necessary as long as each carries its own name.

Each message processor, message source or transformer carries a config-ref attribute that allows the invoker to specify which configuration to use.

Attributes
TypeNameDefault ValueDescription
xs:string name Optional. Give a name to this configuration so it can be later referenced.
objectStore Optional. Reference to an Object Store bean.
xs:string partition Optional. 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)
xs:boolean persistent false Optional. 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)

Message Processors

<objectstore:all-keys>

Returns a list of all the keys in the store.

IMPORTANT: Not all stores support this method. If the method is not supported a java.lang.UnsupportedOperationException is thrown

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
Child Elements
Return Payload
  • a java.util.List with all the keys in the store.
Exception Payloads
Payload ClassDescription
ObjectStoreException

<objectstore:dual-store>

Store value using key, and also store key using value.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
key The identifier of the object to store
value The object to store. If you want this to be the payload then use value-ref="#[payload]".
overwrite false Optional. True if you want to overwrite the existing object.
Child Elements
Exception Payloads
Payload ClassDescription
ObjectStoreException if the given key cannot be stored or is null.
ObjectStoreNotAvaliableException if the store is not available or any other implementation-specific error occured.
ObjectAlreadyExistsException if an attempt is made to store an object for a key that already has an object associated. Only thrown if overwrite is false.

<objectstore:remove>

Remove the object with key.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
key The identifier of the object to remove.
Child Elements
Return Payload
  • The object that was previously stored for the given key
Exception Payloads
Payload ClassDescription
ObjectStoreException if the given key is null or if the store is not available or any other implementation-specific error occurred
ObjectDoesNotExistException if no value for the given key was previously stored.

<objectstore:retrieve>

Retrieve the given Object.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
key The identifier of the object to retrieve.
defaultValue Optional. The default value if the key does not exists.
Child Elements
Return Payload
  • The object associated with the given key. If no object for the given key was found this method throws an org.mule.api.store.ObjectDoesNotExistException.
Exception Payloads
Payload ClassDescription
ObjectStoreException if the given key is null.
ObjectStoreNotAvaliableException if the store is not available or any other implementation-specific error occured.
ObjectDoesNotExistException if no value for the given key was previously stored.

<objectstore:store>

Store object

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
key The identifier of the object to store
value The object to store. If you want this to be the payload then use value-ref="#[payload]".
overwrite false Optional. True if you want to overwrite the existing object.
Child Elements
Exception Payloads
Payload ClassDescription
ObjectStoreException if the given key cannot be stored or is null.
ObjectStoreNotAvaliableException if the store is not available or any other implementation-specific error occured.
ObjectAlreadyExistsException if an attempt is made to store an object for a key that already has an object associated. Only thrown if overwrite is false.