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

Feature: Replay messages #1618

Open
limx0 opened this issue Jul 23, 2024 · 2 comments
Open

Feature: Replay messages #1618

limx0 opened this issue Jul 23, 2024 · 2 comments
Labels
enhancement New feature or request Redis Issues related to `faststream.redis` module and Redis features

Comments

@limx0
Copy link

limx0 commented Jul 23, 2024

Is your feature request related to a problem? Please describe.
I would like to be able to replay the messages stored on a persistent queue on subscribe on process start. If my process restarts, I would like the option to replay some or all of the messages on a given topic/queue.

Describe the solution you'd like
Add some sort of replay or start_timestamp kwargs for subscribe that allows replaying messages stored in backend on startup.

Feature code example
To help others understand the proposed feature, illustrate it with a FastStream code example:

from faststream import FastStream

broker = RedisBroker()

@broker.subscriber(stream="mytopic", replay=True)
async def handle(msg):
    # Message is the first message in the redis steam
    print(msg)

Describe alternatives you've considered
I thought this would have discussed/implemented given the majority of backends support this functionality (RMQ, redis, nats, kafka), but I can't find anything in the docs or issues.

Additional context
Apologies if I've somehow missed something here!

@limx0 limx0 added the enhancement New feature or request label Jul 23, 2024
@Lancetnik
Copy link
Member

Lancetnik commented Aug 4, 2024

Hi! I am sure, that you are able to implement such behavior already by playing with various stream options (last_id at least). I'll try to dig into to help your.

Btw, did you tried to use persisntent subscriber (it saves read position between restarts): https://faststream.airt.ai/0.5/redis/streams/groups/

@Lancetnik Lancetnik added the Redis Issues related to `faststream.redis` module and Redis features label Aug 4, 2024
@Lancetnik
Copy link
Member

@kumaranvpl you have a bigger expertiece in Redis, can you please take a quick look and decide, should has it sence, should we add new API for it or it is already implemented by some options. Just for backlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Redis Issues related to `faststream.redis` module and Redis features
Projects
Status: Backlog
Development

No branches or pull requests

2 participants