Spring Redis
Since Camel 2.11
Both producer and consumer are supported
This component allows sending and receiving messages from Redis. Redis is an 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 communications. Camel provides a producer for executing commands, consumer for subscribing to pub/sub messages an idempotent repository for filtering out duplicate messages.
| Prerequisites To use this component, you must have a Redis server running. |
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Spring Redis component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Autowired The org.springframework.data.redis.core.RedisTemplate that the producers of the endpoints of this component run the commands with, unless an endpoint sets its own redisTemplate. Autowired from the registry when it has exactly one RedisTemplate. | RedisTemplate | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The Spring Redis endpoint is configured using URI syntax:
spring-redis:host:port
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The host name or IP address of the Redis server. The endpoint connects to it with the JedisConnectionFactory that it creates when connectionFactory is not set, and does not use it otherwise. If not set, localhost is used. | localhost | String | |
Required The port of the Redis server. The endpoint connects to it with the JedisConnectionFactory that it creates when connectionFactory is not set, and does not use it otherwise. If not set, 6379 is used. | 6379 | Integer |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The Redis command that the producer runs, such as GET, SET or HSET. The CamelRedis.Command header replaces this option for a message. The consumer needs SUBSCRIBE or PSUBSCRIBE and fails to start with any other command, including the default SET. The producer fails a message with SUBSCRIBE, PSUBSCRIBE or a server command that it does not run, such as AUTH, FLUSHDB, INFO or SELECT. Enum values:
| SET | Command | |
The org.springframework.data.redis.connection.RedisConnectionFactory that connects to Redis. The endpoint uses it for the RedisTemplate and the listener container that it creates, and then does not use host and port. If not set, the endpoint creates a JedisConnectionFactory for host and port, and destroys it when the endpoint shuts down. | RedisConnectionFactory | ||
The org.springframework.data.redis.serializer.RedisSerializer for keys and values. The endpoint sets it as the default serializer of the RedisTemplate that it creates, and the consumer deserializes the body of each message with it. If not set, a JdkSerializationRedisSerializer is used, which stores keys and values in Java serialized form: use a StringRedisSerializer to work with text. The producer does not use it when a redisTemplate is set. | RedisSerializer | ||
The channels that the consumer subscribes to, separated by comma. With the PSUBSCRIBE command they are patterns, such as news.*, and with SUBSCRIBE channel names. Required by the consumer. The producer does not use it: PUBLISH takes the channel from the CamelRedis.Channel header. | String | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
The org.springframework.data.redis.listener.RedisMessageListenerContainer that the consumer subscribes to the channels with. If not set, the endpoint creates and starts one on connectionFactory, and destroys it when the endpoint shuts down. | RedisMessageListenerContainer | ||
The org.springframework.data.redis.core.RedisTemplate that the producer runs the commands with, which also decides how keys and values are serialized. If not set, the redisTemplate of the component is used, and if that is not set either, the endpoint creates a RedisTemplate from connectionFactory and serializer. The consumer does not use it. | RedisTemplate | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
An ObjectInputFilter pattern, in jdk.serialFilter syntax, that the default JdkSerializationRedisSerializer applies when it deserializes a value: the body of a message that the consumer receives, and a value that the producer reads with the RedisTemplate that the endpoint creates. If not set, the JVM-wide jdk.serialFilter is used when present, otherwise a default filter that rejects java.net., allows only java., javax. and org.apache.camel., and limits the depth, references and size of the object graph. Not used when serializer is set. | String |
Message Headers
The Spring Redis component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
| Constant: | The name of the Redis command that the producer runs, such as GET or HSET, in any case. Replaces the command option for this message. | String | |
| Constant: | The key that the command works on, used by most commands, such as GET, SET, HSET, LPUSH, SADD and ZADD. For SDIFF, SINTER, SUNION, their STORE forms, ZINTERSTORE and ZUNIONSTORE, the first key, which is combined with the keys of the CamelRedis.Keys header. | String | |
| Constant: | The keys to delete for DEL and to watch for WATCH, and for SDIFF, SINTER, SUNION, their STORE forms, ZINTERSTORE and ZUNIONSTORE the keys that are combined with the key of the CamelRedis.Key header. A collection of keys, or a String with one key or several keys separated by comma. | Collection or String | |
| Constant: | The field of the hash for HDEL, HEXISTS, HGET, HINCRBY, HSET and HSETNX. | String | |
| Constant: | The fields of the hash to read for HMGET, and the keys to read for MGET. | Collection | |
| Constant: | The value for the commands that store, add or look up one value or member, such as SET, SETNX, GETSET, HSET, LPUSH, SADD, SISMEMBER, ZADD and GEOADD. It is a Long for INCRBY, DECRBY and HINCRBY, a Boolean for SETBIT, the new name of the key for RENAME and RENAMENX, and text for APPEND and ECHO. The serializer of the RedisTemplate writes it, so with the default JDK serializer it must be Serializable. | Object | |
| Constant: | A Map of keys to values for MSET and MSETNX, and of fields to values for HMSET. For GEODIST, a Collection whose first two elements are the members to measure the distance between. | Map | |
| Constant: | The index of the first element for LRANGE, LTRIM, ZRANGE, ZREVRANGE and ZREMRANGEBYRANK, the offset of the first byte for GETRANGE, and the minimum score for ZREMRANGEBYSCORE when CamelRedis.Min is not set. Indexes start at 0, and a negative index counts from the end. | Long | |
| Constant: | The index of the last element, inclusive, for LRANGE, LTRIM, ZRANGE, ZREVRANGE and ZREMRANGEBYRANK, the offset of the last byte for GETRANGE, and the maximum score for ZREMRANGEBYSCORE when CamelRedis.Max is not set. Indexes start at 0, and a negative index counts from the end, so -1 is the last element. | Long | |
| Constant: | The time to live of the key in seconds for EXPIRE and SETEX, and in milliseconds for PEXPIRE. For BLPOP, BRPOP and BRPOPLPUSH, how many seconds to wait for an element while the list is empty. | Long | |
| Constant: | The offset of the bit for GETBIT and SETBIT, and the offset in bytes where SETRANGE writes the value. | Long | |
CamelRedis.Destination (producer) Constant: | The key that receives the result for RPOPLPUSH, BRPOPLPUSH, SMOVE, SDIFFSTORE, SINTERSTORE, SUNIONSTORE, ZINTERSTORE and ZUNIONSTORE. | String | |
| Constant: | The channel that PUBLISH posts the message to. The consumer sets it to the name of the channel that the message was received on. | String | |
| Constant: | The message that PUBLISH posts to the channel of the CamelRedis.Channel header. The serializer of the RedisTemplate writes it, so with the default JDK serializer it must be Serializable. | Object | |
| Constant: | The index of the element of the list for LINDEX and LSET. Indexes start at 0, and a negative index counts from the end, so -1 is the last element. | Long | |
CamelRedis.Position (producer) Constant: | Where LINSERT inserts the value: BEFORE or AFTER the pivot, in upper case. | String | |
| Constant: | The element of the list that LINSERT inserts the value before or after. | String | |
| Constant: | For LREM, how many elements equal to the value to remove: a positive count removes from the head, a negative count from the tail, and 0 removes all of them. For GEORADIUS and GEORADIUSBYMEMBER, the maximum number of members to return; if not set, all of them are returned. | Long | |
CamelRedis.Timestamp (producer) Constant: | The time when the key expires, in seconds since the epoch for EXPIREAT and in milliseconds since the epoch for PEXPIREAT. | Long | |
| Constant: | The glob-style pattern of the keys that KEYS returns, such as user:*. With the PSUBSCRIBE command, the consumer sets it, as a byte array, to the pattern of the channels option that the channel of the message matched. | byte[] or String | |
| Constant: | The index of the database that MOVE moves the key to. | Integer | |
| Constant: | The score of the member that ZADD adds. | Double | |
| Constant: | The minimum score, inclusive, for ZCOUNT, ZRANGEBYSCORE, ZREVRANGEBYSCORE and ZREMRANGEBYSCORE. | Double | |
| Constant: | The maximum score, inclusive, for ZCOUNT, ZRANGEBYSCORE, ZREVRANGEBYSCORE and ZREMRANGEBYSCORE. | Double | |
CamelRedis.Increment (producer) Constant: | The amount that ZINCRBY adds to the score of the member. | Double | |
CamelRedis.WithScore (producer) Constant: | Whether ZRANGE and ZREVRANGE return the members together with their scores, as a Set of ZSetOperations.TypedTuple. If not set or false, they return the members only. | Boolean | |
CamelRedis.Latitude (producer) Constant: | The latitude of the member that GEOADD adds, and of the center of the area that GEORADIUS searches. | Double | |
CamelRedis.Longitude (producer) Constant: | The longitude of the member that GEOADD adds, and of the center of the area that GEORADIUS searches. | Double | |
| Constant: | The radius in meters of the area that GEORADIUS and GEORADIUSBYMEMBER search. | Double |
Message Body
The message body at each side of the Spring Redis component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| The message as the serializer reads it: with the default JDK serializer the Java object the publisher serialized, such as the String a PUBLISH of this component sent, with the channel in the CamelRedis.Channel header. A message the serializer cannot read, such as text from redis-cli, is given as its raw bytes: set a StringRedisSerializer as the serializer to receive text. |
Producer input |
| The body is not used: the key, the value and the other arguments of the command come from headers, such as CamelRedis.Key and CamelRedis.Value, or CamelRedis.Channel and CamelRedis.Message for PUBLISH. Set CamelRedis.Value from the body to store the body: with the default serializer it must be Serializable, so a stream fails. |
Producer output |
| The result of the command, which the CamelRedis.Command header can pick instead of the command option: SET, the default, PUBLISH and the other commands without a result keep the body; a Boolean or a number for those that test, count or increment, a Set or a List for those that read several members, a Map for HGETALL, and the stored object, which can be anything, for GET, HGET, LINDEX, LPOP, RPOP, SPOP and the other commands that read or pop one value: these are not known. These set the body to null when there is no value, such as GET of a missing key. An unknown command, or one the producer does not run, fails.
Not known when |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Usage
See also the unit tests available at https://github.com/apache/camel/tree/main/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis.
Examples
The producer runs the command of the command option, or of the CamelRedis.Command header. The parameters of the command come from headers, such as CamelRedis.Key and CamelRedis.Value, not from the message body. The tables below list the parameters of each command. The result of the command becomes the message body, and a command without a result, such as SET, leaves the body as it was. A command that reads one value sets the body to null when there is no value, such as GET of a missing key:
- route:
from:
uri: direct:save-greeting
steps:
- setHeader:
name: CamelRedis.Key
expression:
constant:
expression: greeting
- setHeader:
name: CamelRedis.Value
expression:
simple:
expression: "${body}"
- to:
uri: spring-redis:localhost:6379
parameters:
command: SET
- route:
from:
uri: direct:read-greeting
steps:
- setHeader:
name: CamelRedis.Key
expression:
constant:
expression: greeting
- to:
uri: spring-redis:localhost:6379
parameters:
command: GET
- log:
message: "The greeting is ${body}" The consumer needs command set to SUBSCRIBE (channel names) or PSUBSCRIBE (channel patterns), and receives the messages posted to these channels. A producer posts a message with PUBLISH:
- route:
from:
uri: spring-redis:localhost:6379
parameters:
command: SUBSCRIBE
channels: orders
steps:
- log:
message: "Order event: ${body}"
- route:
from:
uri: direct:publish-order
steps:
- setHeader:
name: CamelRedis.Channel
expression:
constant:
expression: orders
- setHeader:
name: CamelRedis.Message
expression:
simple:
expression: "${body}"
- to:
uri: spring-redis:localhost:6379
parameters:
command: PUBLISH By default, keys and values are stored with Java serialization, so other Redis clients do not find the key greeting. To store plain strings, set a StringRedisSerializer as the serializer, on every endpoint that reads or writes these keys:
- route:
from:
uri: direct:save-greeting
steps:
- setHeader:
name: CamelRedis.Key
expression:
constant:
expression: greeting
- setHeader:
name: CamelRedis.Value
expression:
simple:
expression: "${body}"
- to:
uri: spring-redis:localhost:6379
parameters:
command: SET
serializer: "#class:org.springframework.data.redis.serializer.StringRedisSerializer" The KEYS command sends its pattern through the key serializer too. With the default Java serialization a stored key starts with the bytes of the serialization header, so a pattern such as order-* matches no key. Use KEYS with keys stored as plain strings: set a StringRedisSerializer as the serializer as above, or, to keep Java serialization for the values, a redisTemplate with a StringRedisSerializer as its key serializer:
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.afterPropertiesSet(); The consumer deserializes each message with the serializer, which is Java serialization by default. A message that the serializer cannot read, such as one posted as text by redis-cli PUBLISH or another Redis client, is given to the route as its raw bytes (byte[]). To receive such messages as text, set serializer=#class:org.springframework.data.redis.serializer.StringRedisSerializer on the consumer. When the route fails to process a message, the exchange is handed to the exception handler of the consumer (see the exceptionHandler and bridgeErrorHandler options).
Message headers evaluated by the Redis producer
The producer issues commands to the server, and each command has a different set of parameters with specific types. The result from the command execution is returned in the message body. A command whose result is void leaves the body as it was. The value commands, such as GET, HGET and LPOP, return the object that was stored: with the default serializer the Java object the CamelRedis.Value header held.
The commands that read one value set the body to null when there is no value, such as GET of a key that does not exist, so a route can tell a miss from a value. These are GET, GETSET, HGET, LINDEX, LPOP, RPOP, BLPOP, BRPOP (also when the timeout passes), RPOPLPUSH, BRPOPLPUSH, SPOP, SRANDMEMBER, RANDOMKEY, ZSCORE, ZRANK, ZREVRANK and GEODIST.
The CamelRedis.Keys header is a Collection<String>, or a String with one key or several keys separated by comma (a key that holds a comma needs the Collection form).
The producer fails the exchange when the command is not one of the commands listed below: an unknown command fails with an IllegalArgumentException, and a command of the command option that the producer does not run (such as AUTH, FLUSHDB, INFO or SELECT) fails with an UnsupportedOperationException. SUBSCRIBE and PSUBSCRIBE are for the consumer; the producer posts messages with PUBLISH.
| Hash Commands | Description | Parameters | Result |
|---|---|---|---|
| Set the string value of a hash field |
| void |
| Get the value of a hash field |
| Object |
| Set the value of a hash field only if the field does not exist |
| Boolean |
| Set multiple hash fields to multiple values |
| void |
| Get the values of all the given hash fields |
| Collection<Object> |
| Increment the integer value of a hash field by the given number |
| Long |
| Determine if a hash field exists |
| Boolean |
| Delete one or more hash fields |
| void |
| Get the number of fields in a hash |
| Long |
| Get all the fields in a hash |
| Set<String> |
| Get all the values in a hash |
| Collection<Object> |
| Get all the fields and values in a hash |
| Map<String, Object> |
| List Commands | Description | Parameters | Result |
|---|---|---|---|
| Append one or multiple values to a list |
| Long |
| Append a value to a list only if the list exists |
| Long |
| Prepend one or multiple values to a list |
| Long |
| Get the length of a list |
| Long |
| Get a range of elements from a list |
| List<Object> |
| Trim a list to the specified range |
| void |
| Get an element from a list by its index |
| Object |
| Insert an element before or after another element in a list |
| Long |
| Set the value of an element in a list by its index |
| void |
| Remove elements from a list |
| Long |
| Remove and get the first element in a list |
| Object |
| Remove and get the last element in a list |
| Object |
| Remove the last element in a list, append it to another list and return it |
| Object |
| Pop a value from a list, push it to another list and return it; or block until one is available |
| Object |
| Remove and get the first element in a list, or block until one is available |
| Object |
| Remove and get the last element in a list, or block until one is available |
| Object |
| Set Commands | Description | Parameters | Result |
|---|---|---|---|
| Add one or more members to a set |
| Long |
| Get all the members in a set |
| Set<Object> |
| Remove one or more members from a set |
| Long |
| Remove and return a random member from a set |
| Object |
| Move a member from one set to another |
| Boolean |
| Get the number of members in a set |
| Long |
| Determine if a given value is a member of a set |
| Boolean |
| Intersect multiple sets |
| Set<Object> |
| Intersect multiple sets and store the resulting set in a key |
| void |
| Add multiple sets |
| Set<Object> |
| Add multiple sets and store the resulting set in a key |
| void |
| Subtract multiple sets |
| Set<Object> |
| Subtract multiple sets and store the resulting set in a key |
| void |
| Get one or multiple random members from a set |
| Object |
| Ordered set Commands | Description | Parameters | Result |
|---|---|---|---|
| Add one or more members to a sorted set, or update its score if it already exists |
| Boolean |
| Return a range of members in a sorted set, by index |
| Object |
| Remove one or more members from a sorted set |
| Long |
| Increment the score of a member in a sorted set |
| Double |
| Determine the index of a member in a sorted set |
| Long |
| Determine the index of a member in a sorted set, with scores ordered from high to low |
| Long |
| Return a range of members in a sorted set, by index, with scores ordered from high to low |
| Object |
| Get the score of a member in a sorted set |
| Double |
| Get the number of members in a sorted set |
| Long |
| Count the members in a sorted set with scores within the given values |
| Long |
| Return a range of members in a sorted set, by score |
| Set<Object> |
| Return a range of members in a sorted set, by score, with scores ordered from high to low |
| Set<Object> |
| Remove all members in a sorted set within the given indexes |
| void |
| Remove all members in a sorted set within the given scores |
| void |
| Add multiple sorted sets and store the resulting-sorted set in a new key |
| void |
| Intersect multiple sorted sets and store the resulting sorted set in a new key |
| void |
| String Commands | Description | Parameters | Result |
|---|---|---|---|
| Set the string value of a key |
| void |
| Get the value of a key |
| Object |
| Get the length of the value stored in a key |
| Long |
| Append a value to a key |
| Integer |
| Sets or clears the bit at offset in the string value stored at key |
| void |
| Returns the bit value at offset in the string value stored at key |
| Boolean |
| Overwrite part of a string at key starting at the specified offset |
| void |
| Get a substring of the string stored at a key |
| String |
| Set the value of a key only if the key does not exist |
| Boolean |
| Set the value and expiration of a key |
| void |
| Decrement the integer value of a key by the given number |
| Long |
| Decrement the integer value of a key by one |
| Long |
| Increment the integer value of a key by the given amount |
| Long |
| Increment the integer value of a key by one |
| Long |
| Get the values of all the given keys |
| List<Object> |
| Set multiple keys to multiple values |
| void |
| Set multiple keys to multiple values only if none of the keys exist |
| Boolean |
| Set the string value of a key and return its old value |
| Object |
| Key Commands | Description | Parameters | Result |
|---|---|---|---|
| Determine if a key exists |
| Boolean |
| Delete a key |
| void |
| Determine the type stored at key |
| String |
| Find all keys matching the given pattern (needs keys stored as strings, see above) |
| Set<String> |
| Return a random key from the keyspace |
| String |
| Rename a key |
| void |
| Rename a key, only if the new key does not exist |
| Boolean |
| Set a key’s time to live in seconds |
| Boolean |
| Sort the elements in a list, set or sorted set |
| List<Object> |
| Remove the expiration from a key |
| Boolean |
| Set the expiration for a key as a UNIX timestamp |
| Boolean |
| Set a key’s time to live in milliseconds |
| Boolean |
| Set the expiration for a key as a UNIX timestamp specified in milliseconds |
| Boolean |
| Get the time to live for a key |
| Long |
| Move a key to another database |
| Boolean |
| Geo Commands | Description | Parameters | Result |
|---|---|---|---|
| Adds the specified geospatial items (latitude, longitude, name) to the specified key |
| Long |
| Return the distance between two members in the geospatial index for the specified key |
| Distance |
| Return valid Geohash strings representing the position of an element in the geospatial index for the specified key |
| List<String> |
| Return the positions (longitude, latitude) of an element in the geospatial index for the specified key |
| List<Point> |
| Return the element in the geospatial index for the specified key which is within the borders of the area specified with the center location and the maximum distance from the center (the radius) |
| GeoResults |
| This command is exactly like GEORADIUS with the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index for the specified key |
| GeoResults |
| Other Command | Description | Parameters | Result |
|---|---|---|---|
| Mark the start of a transaction block | none | void |
| Discard all commands issued after MULTI | none | void |
| Execute all commands issued after MULTI | none | void |
| Watch the given keys to determine execution of the MULTI/EXEC block |
| void |
| Forget about all watched keys | none | void |
| Echo the given string (fails when the header is missing) |
| String |
| Ping the server | none | String |
| Close the connection | none | void |
| Post a message to a channel |
| void |
Dependencies
Maven users will need to add the following dependency to their pom.xml.
pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-redis</artifactId>
<version>${camel-version}</version>
</dependency> where ${camel-version} must be replaced by the actual version of Camel.