[ 
https://issues.apache.org/jira/browse/CAMEL-27616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-27616.
---------------------------------
    Resolution: Fixed

Merged with https://github.com/apache/camel/pull/31003 as 379badf5aa55 on main 
(4.24.0).

_Claude Code on behalf of Claus Ibsen_

> camel-spring-redis: ZREMRANGEBYSCORE Long score range, syntax typo, required 
> flags, labels
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27616
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27616
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-redis
>            Reporter: Claus Ibsen
>            Assignee: shashank
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while improving the option descriptions of camel-spring-redis for 
> CAMEL-23832 (PR https://github.com/apache/camel/pull/30953).
> These are separate problems of the component; the descriptions PR only 
> documents the current behavior.
> h4. 1. ZREMRANGEBYSCORE takes the score range as Long from the Start and End 
> headers
> {{RedisProducer.invokeZremrangebyscore()}} reads the range from 
> {{CamelRedis.Start}} and {{CamelRedis.End}} with 
> {{ExchangeConverter.getStart()}} and {{getEnd()}}, which convert to {{Long}}, 
> and {{RedisClient.zremrangebyscore(String, Long, Long)}} passes them to 
> {{ZSetOperations.removeRangeByScore()}}.
> The other score commands ({{ZCOUNT}}, {{ZRANGEBYSCORE}}, 
> {{ZREVRANGEBYSCORE}}) read {{CamelRedis.Min}} and {{CamelRedis.Max}} as 
> {{Double}}. So a route cannot remove members by a fractional score range, and 
> a route that sets Min and Max as for the other commands fails with a 
> NullPointerException, as the null Start and End are unboxed to {{double}}.
> Proposed change: read {{CamelRedis.Min}} and {{CamelRedis.Max}} as {{Double}} 
> for {{ZREMRANGEBYSCORE}}, and keep Start and End as a fallback for existing 
> routes (with an upgrade guide note).
> h4. 2. Typo in the endpoint syntax
> {{RedisEndpoint}} has {{@UriEndpoint(syntax = "spring-redist:host:port")}}. 
> The generated JSON shows {{spring-redis:host:port}}, but the source 
> annotation has the wrong scheme.
> Proposed change: fix the syntax to {{spring-redis:host:port}}.
> h4. 3. host and port are marked as required but have defaults
> {{RedisConfiguration.host}} and {{port}} have {{@Metadata(required = true)}}. 
> {{RedisComponent.setHostAndPort()}} only sets them when the path has them, 
> and {{RedisConfiguration.createDefaultConnectionFactory()}} only passes them 
> to the {{JedisConnectionFactory}} when they are not null, so it falls back to 
> localhost and 6379. Neither is used when {{connectionFactory}} is set.
> Proposed change: drop {{required = true}} and set {{defaultValue}} to 
> localhost and 6379, or keep them required and fail when they are missing.
> h4. 4. Missing labels on consumer-only and producer-only options
> {{channels}} is only read by {{RedisConsumer.toTopics()}}, and 
> {{redisTemplate}} is only used by {{RedisEndpoint.createProducer()}}, but 
> neither has a label, so both are listed as common options. 
> {{connectionFactory}} and {{serializer}} have no label either; only 
> {{listenerContainer}} has {{consumer,advanced}}.
> Proposed change: label {{channels}} as consumer and {{redisTemplate}} as 
> producer, and consider advanced for {{connectionFactory}} and {{serializer}}.
> h4. 5. Wrong javaType of the CamelRedis.Channel header
> {{RedisConstants.CHANNEL}} has {{javaType = "byte[] or String"}}. 
> {{RedisConsumer.setChannel()}} sets a {{String}} (UTF-8 decoded), and 
> {{ExchangeConverter.getChannel()}} reads a {{String}} for {{PUBLISH}}.
> Proposed change: set the javaType to {{String}}.
> h4. 6. Headers have no consumer or producer label
> Only {{CamelRedis.Command}} has a label (producer). The consumer sets 
> {{CamelRedis.Channel}} and {{CamelRedis.Pattern}}; all other headers in 
> {{RedisConstants}} are only read by the producer.
> Proposed change: label the producer-only headers as producer, and Channel and 
> Pattern as common, since both sides use them.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to