[CONF] Apache Camel Spring Redis

2014-04-29 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


Spring Redis   






...
This component allows sending and receiving messages from Redis. Redis is advanced key-value store where keys can contain strings, hashes, lists, sets and sorted sets. In addition it provides pub/sub functionality for inter-app comunicationscommunications. Camel provides a producer for executing commands, consumer for subscribing to pub/sub messages an idempotent repository for filtering out duplicate messages.



 Info








title
Prerequisites


 




 In order to use this component, you must have a Redis server running. 



URI Format



 Code Block




 

spring-redis://host:port[?options]
 



...
Message headers evaluated by the Redis producer
The producer issues commads commands to the server and each command has different set of parameters with specific types. The result from the command execution is returned in the message body.
...



 Wiki Markup


   

[CONF] Apache Camel Spring Redis

2013-03-12 Thread confluence







Spring Redis
Page edited by Claus Ibsen


 Changes (0)
 




...


Full Content

Spring Redis Component
Available as of Camel 2.11

This component allows sending and receiving messages from Redis. Redis is advanced key-value store where keys can contain strings, hashes, lists, sets and sorted sets. In addition it provides pub/sub functionality for inter-app comunications.
Camel provides a producer for executing commands, consumer for subscribing to pub/sub messages an idempotent repository for filtering out duplicate messages.

PrerequisitesIn order to use this component, you must have a Redis server running.

URI Format


spring-redis://host:port[?options]


You can append query options to the URI in the following format, ?options=valueoption2=value...

URI Options



 Name 
 Default Value 
 Context 
 Description 


host
 null 
 Both 
 The host where Redis server is running. 


port
 null 
 Both 
 Redis port number. 


command
 SET 
 Both 
 Default command, which can be overriden by message header. 


channels
 SET 
 Consumer 
 List of topic names or name patterns to subscibe to. 


redisTemplate
 null 
 Producer 
 Reference to a pre-configured org.springframework.data.redis.core.RedisTemplate instance in the Registry. 


connectionFactory
 null 
 Both 
 Reference to a org.springframework.data.redis.connection.RedisConnectionFactory instance in the Registry. 


listenerContainer
 null 
 Consumer 
 Referebce to a org.springframework.data.redis.listener.RedisMessageListenerContainer instance in the Registry instance in the Registry. 


serializer
 null 
 Consumer 
 Referebce to a org.springframework.data.redis.serializer.RedisSerializer instance in the Registry. 





Usage
Message headers evaluated by the Redis producer
The producer issues commads to the server and each command has different set of parameters with specific types. The result from the command execution is returned in the message body. 



 Hash Commands 
 Description 
 Parameters 
 Result 


 HSET 
 Set the string value of a hash field 
 CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value (Object) 
 void 


 HGET 
 Get the value of a hash field 
 CamelRedis.Key (String), CamelRedis.Field (String) 
 String 


 HSETNX 
 Set the value of a hash field, only if the field does not exist 
 CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value (Object) 
 void 


 HMSET 
 Set multiple hash fields to multiple values 
 CamelRedis.Key (String), CamelRedis.Values(MapString, Object) 
 void 


 HMGET 
 Get the values of all the given hash fields 
 CamelRedis.Key (String), CamelRedis.Fields (CollectionString) 
 CollectionObject 


 HINCRBY 
 Increment the integer value of a hash field by the given number 
 CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value (Long) 
 Long 


 HEXISTS 
 Determine if a hash field exists 
 CamelRedis.Key (String), CamelRedis.Field (String) 
 Boolean 


 HDEL 
 Delete one or more hash fields 
 CamelRedis.Key (String), CamelRedis.Field (String) 
 void 


 HLEN 
 Get the number of fields in a hash 
 CamelRedis.Key (String) 
 Long 


 HKEYS 
 Get all the fields in a hash 
 CamelRedis.Key (String) 
 SetString 


 HVALS 
 Get all the values in a hash 
 CamelRedis.Key (String) 
 CollectionObject 


 HGETALL 
 Get all the fields and values in a hash 
 CamelRedis.Key (String) 
 MapString, Object 








 List Commands 
 Description 
 Parameters 
 Result 


 RPUSH 
 Append one or multiple values to a list 
 CamelRedis.Key (String), CamelRedis.Value (Object) 
 Long 


 RPUSHX 
 Append a value to a list, only if the list exists 
 CamelRedis.Key (String), CamelRedis.Value (Object) 
 Long 


 LPUSH 
 Prepend one or multiple values to a list 
 CamelRedis.Key (String), CamelRedis.Value (Object) 
 Long 


 LLEN 
 Get the length of a list 
 CamelRedis.Key (String) 
 Long


 LRANGE 
 Get a range of elements from a list 
 CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) 
 ListObject 


 LTRIM 
 Trim a list to the specified range 
 CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) 
 void 


 LINDEX 
 Get an element from a list by its index 
 CamelRedis.Key (String), CamelRedis.Index (Long) 
 String 


 LINSERT 
 Insert an element before or after another element in a list 
 CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Pivot (String), CamelRedis.Position (String) 
 Long 


 LSET 
 Set the value of an element in a list by its index 
 CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Index (Long) 
 void 


 LREM 
 Remove elements from a list 
 CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Count (Long) 
 Long 


 LPOP 
 Remove and get the first element in a list 
 CamelRedis.Key (String) 
 Object 


 RPOP