Skip to content

Bug: consumers of a redis StreamSub consumer groups are unable to read messages from before the creation of the group. #2694

@pponnuru

Description

@pponnuru

Describe the bug
When using redis StreamSub with consumer groups, consumers of a group are unable to read messages from before the creation of the group.

How to reproduce
Include source code:

from faststream import FastStream
...

And/Or steps to reproduce the behavior:

  1. Ensure a redis stream has existing messages
  2. Start a faststream app with a redis StreamSub -
    broker.subscriber(stream=StreamSub(stream="my_stream", group="my_group", consumer="my_consumer", last_id="0"))

Expected behavior
I expect the handler to receive the existing messages in the stream.

Observed behavior
It does not.

Screenshots
If applicable, attach screenshots to help illustrate the problem.

Environment
Running FastStream 0.6.2 with CPython 3.12.12 on Linux

Additional context
The issue is how last_id is used with xgroupcreate and xreadgroup.
If am not wrong, to be able to read messages from the beginning of a redis stream, xgroupcreate must be created with last_id "0" and xreadgroup with last_id ">". But when StreamSub is created with last_id = "0", even the xreadgroup is called with last_id="0" and this does not return any messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions