Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for xautoclaim #2316

Open
7ravis opened this issue May 5, 2022 · 7 comments
Open

add support for xautoclaim #2316

7ravis opened this issue May 5, 2022 · 7 comments
Labels
type: enhancement A general enhancement

Comments

@7ravis
Copy link

7ravis commented May 5, 2022

hi. I'm using Spring Boot 2.6.6. right now, in order to run the xautoclaim command, I have to get the native lettuce client and use a lettuce command interface . I would prefer to use Spring's higher-level Reactive/StreamOperations interface, but xautoclaim is not currently supported. please add Reactive/StreamOperations support for xautoclaim. on my Spring version, regular xclaim is also not supported in Reactive/StreamOperations, but it's supported in Reactive/StreamCommands. if, for some reason, there is less resistance to add xautoclaim at the Reactive/StreamCommands level, that would also be preferable to what I'm currently doing. thanks!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 5, 2022
@christophstrobl christophstrobl added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels May 9, 2022
@hemju
Copy link

hemju commented Jan 27, 2023

Would be nice to have xautoclaim supported. Any news for which version it is planned?

@softprog
Copy link

softprog commented Apr 3, 2023

how this issue,please

@RomainWilbert
Copy link

At this point, using xautoclaim causes a direct dependency to the redis client :(

@kkocel
Copy link

kkocel commented Jul 26, 2024

I've ended up with getting a client from LettuceConnectionFactory and calling it directly:

    private val xAutoClaimArgs: XAutoClaimArgs<String> =
        XAutoClaimArgs.Builder
            .xautoclaim(
                Consumer.from(consumerGroupName, consumerName),
                messageDuration,
                "0-0",
            ).count(messagesToClaim)

    private val commands = commands(lettuceConnectionFactory.requiredNativeClient)

    private fun commands(client: AbstractRedisClient): RedisClusterCommands<String, String> =
        when (client) {
            is RedisClient -> {
                client.connect().sync()
            }
            is RedisClusterClient -> {
                client.connect().sync()
            }
            else -> {
                throw IllegalArgumentException("Unsupported Redis client type")
            }
        }

    fun reclaim(): MutableList<StreamMessage<String, String>> =
        commands.xautoclaim(streamName, xAutoClaimArgs).messages
        }

@ivan-kripakov-m10
Copy link
Contributor

Hello,
It seems the issue is still relevant, as there is currently no support for the xautoclaim command. I am interested in contributing to this, but I have a few questions to clarify before:

  1. Are there any existing plans that might block or conflict with this functionality addition?
  2. If not, would you prefer the xautoclaim command to support cursor-like behavior, or would simply returning the RecordId to be used as a start argument in the next call be sufficient?

@kkocel
Copy link

kkocel commented Sep 17, 2024

@ivan-kripakov-m10 Hi, I started adding this feature as well - it's WiP - feel free to base your work on it or fork my main: e94fdd4

There are some issues related to xautoclaim - for instance, Lettuce does not fully support this command - it does not provide deleted entries.

As for your second question - I added new class that stores record id and lists of claimed and deleted entries

@ivan-kripakov-m10
Copy link
Contributor

@kkocel Hi,
Did you discuss the solution plan with the team?
The answer to the second question can significantly impact both solution and library client code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

8 participants