Add overloads to `StreamOperations` accepting `XAddOptions`
HI
Hi,
I am currently using redisTemplate.opsForStream() to operate on Redis streams. When using the add method, I want to support more parameters such as MAXID and MINID. However, it is not supported at the moment. I noticed that RedisStreamCommands already provides XAddOptions, but currently (in version 3.3.X), there is no way to set these options, and only the default None is called.
Is it possible to enhance the DefaultStreamOperations.add method to support these parameters?
Example
default RecordId add(Record<K, ?> record, XAddOptions ops) {
return add(record, null)
};
RecordId add(Record<K, ?> record, XAddOptions ops);
Not exactly sure why you've posted details about DefaultStreamOperations. In any case, adding options for the XADD operations are held by XAddOptions. minId and maxlen are already supported, so not sure what you're asking for. Please elaborate.
Not exactly sure why you've posted details about
DefaultStreamOperations. In any case, adding options for theXADDoperations are held byXAddOptions.minIdandmaxlenare already supported, so not sure what you're asking for. Please elaborate.
I want to set the XAddOptions parameter in redisTemplate.opsForStream().add(...) , but there is no method to set the XAddOptions parameter.
Is it possible to add the following API RecordId add(Record<K, ? > record, XAddOptions ops);
Ah, I got it. All the screenshots are pretty distracting and contribute a lot of noise to this ticket. I went ahead and removed these.
It is fine to add overloads accepting XAddOptions in StreamOperations and ReactiveStreamOperations.
Hello, @mp911de May I take this issue?
I've looked through issue and code. I am planning to add interface method
RecordId add(Record<K, ?> record, XAddOptions options)
and override this method in DefaultStreamOperations.
and also same with ReactiveStreamOperations
Do you expect the client code should be like this?
XAddOptions options = XAddOptions.maxlen(1000);
redisTemplate.opsForStream().add("stream", Map.of("key", "value"), options);
if this is the way you implied, i'm happy to make a pr with a few tests to support this change.
Is it possible set global default options?