| Namespace | http://www.mulesoft.org/schema/mule/redis |
|---|---|
| Schema Location | http://www.mulesoft.org/schema/mule/redis/current/mule-redis.xsd (View Schema) |
| Schema Version | 3.4 |
| Minimum Mule Version | 3.4.0 |
Redis is an open-source, networked, in-memory, persistent, journaled, key-value data store. Provides Redis connectivity to Mule:
| Configuration | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Configure an instance of this module
| |||||||||||
| Message Sources | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Subscribe to the specified channels.
| |||||||||||
| Message Processors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Add the message payload to the set stored at the specified key.
| |||||||||||
Add the message payload with the desired score to the sorted set stored at the specified key.
| |||||||||||
Decrements the number stored at key by step.
| |||||||||||
Test if the specified key exists.
| |||||||||||
Set a timeout on the specified key.
| |||||||||||
Set a timeout in the form of a UNIX timestamp (Number of seconds elapsed since 1 Jan 1970) on
the specified key.
| |||||||||||
Get the value of the specified key.
| |||||||||||
Get the value stored at the specified field in the hash at the specified key.
| |||||||||||
Retrieve a range of values from the sorted set stored at the specified key.
| |||||||||||
Retrieve a range of values from the sorted set stored at the specified key.
| |||||||||||
Get the remaining time to live in seconds of a volatile key.
| |||||||||||
Increments the number stored at key by step.
| |||||||||||
Increments the number stored at field in the hash stored at key by increment.
| |||||||||||
Increments the score of member in the sorted set stored at key by increment.
| |||||||||||
Undo an expire or expireAt ; turning the volatile key into a normal key.
| |||||||||||
Pop a value from the desired side of the list stored at the specified key.
| |||||||||||
Pops a random value from the set stored at the specified key.
| |||||||||||
Publish the message payload to the specified channel.
| |||||||||||
Push the message payload to the desired side (LEFT or RIGHT) of the list stored at the
specified key.
| |||||||||||
Reads a random value from the set stored at the specified key.
| |||||||||||
Set key to hold the payload.
| |||||||||||
Set the specified hash field to the message payload.
| |||||||||||
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:redis="http://www.mulesoft.org/schema/mule/redis"
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/redis
http://www.mulesoft.org/schema/mule/redis/current/mule-redis.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 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Type | Name | Default Value | Description | Java Type | MIME Type | Encoding | Optional. Give a name to this configuration so it can be later referenced. | ||||
| 2000 | Optional. Connection timeout in milliseconds. | ||||||||||
| Optional. The PartitionableObjectStore partition to use in case methods from ObjectStore are used. | |||||||||||
| localhost | Optional. Redis host. | ||||||||||
| Optional. Redis password | |||||||||||
| Optional. Object pool configuration. | |||||||||||
| 6379 | Optional. Redis port. | ||||||||||
| 5000 | Optional. Reconnection frequency in milliseconds. | ||||||||||
Add the message payload to the set stored at the specified key. If key does not exist, a new key holding a set is created.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for SADD | String | */* | UTF-8 | ||
| false | Optional. If true, ensures that adding to the set was successful (ie no pre-existing identical value in the set) | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The value to set. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If no new entry has been added to the set and mustSucceed is true, null is returned. Otherwise the message is returned. |
Add the message payload with the desired score to the sorted set stored at the specified key. If key does not exist, a new key holding a sorted set is created.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for ZADD | String | */* | UTF-8 | ||
| Score to use for the value | double | */* | |||
| false | Optional. If true, ensures that adding to the sorted set was successful (ie no pre-existing identical value in the set) | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The value to set. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If no new entry has been added to the sorted set and mustSucceed is true, null is returned. Otherwise the message is returned. |
Decrements the number stored at key by step. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains data that can not be represented as integer.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for DECR. | String | */* | UTF-8 | ||
| 1 | Optional. Step used for the increment. | long | */* |
| Return Type | Description |
|---|---|
| Long | A byte array with the content of the key |
Test if the specified key exists.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for EXISTS | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| Boolean | A boolean that represents the existence of the key. |
Set a timeout on the specified key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| The key in the sorted set. | String | */* | UTF-8 | ||
| The time to live in seconds. | int | */* |
| Return Type | Description |
|---|---|
| Boolean | true if EXPIRE was successful, false otherwise. |
Set a timeout in the form of a UNIX timestamp (Number of seconds elapsed since 1 Jan 1970) on the specified key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| The key in the sorted set. | String | */* | UTF-8 | ||
| The UNIX timestamp in seconds. | long | */* |
| Return Type | Description |
|---|---|
| Boolean | true if EXPIREAT was successful, false otherwise. |
Get the value of the specified key. If the key does not exist null is returned.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for GET | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| byte[] | A byte array with the content of the key |
Get the value stored at the specified field in the hash at the specified key. If the field or the hash don't exist, null is returned.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for HGET | String | */* | UTF-8 | ||
| Field that will be used for HGET | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| byte[] | The value or null. |
Retrieve a range of values from the sorted set stored at the specified key. The range of values is defined by indices in the sorted set and sorted as desired.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for ZRANGE/ZREVRANGE | String | */* | UTF-8 | ||
| Range start index | int | */* | |||
| Range end index | int | */* | |||
| ASCENDING | Optional. Index order for sorting the range, either ASCENDING or DESCENDING | RedisModule.SortedSetOrder | */* |
| Return Type | Description |
|---|---|
| Set<byte[]> | the values in the specified range in the desired order as Set |
Retrieve a range of values from the sorted set stored at the specified key. The range of values is defined by scores in the sorted set and sorted as desired.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for ZRANGEBYSCORE/ZREVRANGEBYSCORE | String | */* | UTF-8 | ||
| Range start score | double | */* | |||
| Range end score | double | */* | |||
| ASCENDING | Optional. Score order for sorting the range, either ASCENDING or DESCENDING | RedisModule.SortedSetOrder | */* |
| Return Type | Description |
|---|---|
| Set<byte[]> | the values in the specified range in the desired order as Set |
Get the remaining time to live in seconds of a volatile key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| The key in the sorted set. | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| Long | the remaining time to live in seconds, -2 when key does not exist or -1 when key does not have a timeout. |
Increments the number stored at key by step. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains data that can not be represented as integer.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for INCR. | String | */* | UTF-8 | ||
| 1 | Optional. Step used for the increment. | long | */* |
| Return Type | Description |
|---|---|
| Long | the incremented number. |
Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for HGET | String | */* | UTF-8 | ||
| Field that will be used for HGET | String | */* | UTF-8 | ||
| 1 | Optional. Step used for the increment. | long | */* |
| Return Type | Description |
|---|---|
| Long | the incremented number. |
Increments the score of member in the sorted set stored at key by increment. If member does not exist in the sorted set, it is added with increment as its score (as if its previous score was 0.0). If key does not exist, a new sorted set with the specified member as its sole member is created.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| The key in the sorted set. | String | */* | UTF-8 | ||
| The step to use to increment the score. | double | */* | |||
| #[message.payloadAs(java.lang.String)] | Optional. The value to set. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| Double | the new score of the member. |
Undo an expire or expireAt ; turning the volatile key into a normal key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| The key in the sorted set. | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| Boolean | true if PERSIST was successful, false otherwise. |
Pop a value from the desired side of the list stored at the specified key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for LPOP/RPOP | String | */* | UTF-8 | ||
| The side where to pop the value from, either LEFT or RIGHT | RedisModule.ListPushSide | */* |
| Return Type | Description |
|---|---|
| byte[] | The popped value or null if either the list is empty or no list exists at the key |
Pops a random value from the set stored at the specified key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for SPOP | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| byte[] | The popped value or null if either the set is empty or no set exists at the key |
Publish the message payload to the specified channel.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Destination of the published message | String | */* | UTF-8 | ||
| false | Optional. Enforces the fact that the message must have been delivered to at least one consumer | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The message to publish. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If no consumer is subscribed to the channel and mustSucceed is true, null is returned. Otherwise the message is returned. |
Push the message payload to the desired side (LEFT or RIGHT) of the list stored at the specified key. If key does not exist, a new key holding a list is created as long as ifExists is not true.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for LPUSH/RPUSH/LPUSHX/RPUSH | String | */* | UTF-8 | ||
| The side where to push the payload, either LEFT or RIGHT | RedisModule.ListPushSide | */* | |||
| false | Optional. If true execute LPUSHX/RPUSH otherwise LPUSH/RPUSH | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The value to push. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If the key doesn't already exist and ifExists is true, null is returned. Otherwise the message is returned. |
Reads a random value from the set stored at the specified key.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for SRANDMEMBER | String | */* | UTF-8 |
| Return Type | Description |
|---|---|
| byte[] | The random value or null if either the set is empty or no set exists at the key |
Set key to hold the payload. If key already holds a value, it is overwritten, regardless of its type as long as ifNotExists is false.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key used to store payload | String | */* | UTF-8 | ||
| Optional. Set a timeout on the specified key. After the timeout the key will be automatically deleted by the server. A key with an associated timeout is said to be volatile in Redis terminology. | Integer | */* | |||
| false | Optional. If true, then execute SETNX on the Redis server, otherwise execute SET | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The value to set. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If the key already exists and ifNotExists is true, null is returned. Otherwise the message is returned. |
Set the specified hash field to the message payload. If key does not exist, a new key holding a hash is created as long as ifNotExists is true.
INCLUDE_ERROR
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Key that will be used for HSET | String | */* | UTF-8 | ||
| Field that will be used for HSET | String | */* | UTF-8 | ||
| false | Optional. If true execute HSETNX otherwise HSET | boolean | */* | ||
| #[message.payloadAs(java.lang.String)] | Optional. The value to set. | String | */* | UTF-8 | |
| The current MuleEvent. | MuleEvent | */* |
| Return Type | Description |
|---|---|
| byte[] | If the field already exists and ifNotExists is true, null is returned, otherwise if a new field is created the message is returned. |
Subscribe to the specified channels.
INCLUDE_ERROR
| Name | Default Value | Description | Java Type | MIME Type | Encoding |
|---|---|---|---|---|---|
| Optional. Specify which configuration to use. | |||||
| Called when messages arrive in any of the specified channels. | SourceCallback | */* |
| Name | Default Value | Description | Java Type |
|---|---|---|---|
| A list of channel names or globbing patterns. | List<String> |