StreamSub
faststream.redis.schemas.stream_sub.StreamSub #
StreamSub(
stream: str,
polling_interval: int | None = None,
group: str | None = None,
consumer: str | None = None,
batch: bool = False,
no_ack: bool = False,
last_id: str | None = None,
maxlen: int | None = None,
max_records: int | None = None,
min_idle_time: int | None = None,
declare: bool = True,
claim_min_idle_time: int | None = None,
)
Bases: NameRequired
A class to represent a Redis Stream subscriber.
| PARAMETER | DESCRIPTION |
|---|---|
batch | Whether to consume messages in batches or not. TYPE: |
max_records | Number of messages to consume as one batch. TYPE: |
consumer | The consumer unique name https://redis.io/docs/latest/develop/tools/insight/tutorials/insight-stream-consumer/#run-the-consumer TYPE: |
group | The name of consumer group TYPE: |
last_id | An Entry ID, which uses to pick up from where it left off after it is restarted. TYPE: |
maxlen | Redis Stream maxlen publish option. Remove eldest message if maxlen exceeded. https://redis.io/docs/latest/develop/data-types/streams/#capped-streams TYPE: |
name | The original Redis Stream name.
|
no_ack | If True, to enable the XREADGROUP NOACK subcommand. https://redis.io/docs/latest/commands/xreadgroup/#differences-between-xread-and-xreadgroup TYPE: |
polling_interval | Polling interval in milliseconds. TYPE: |
min_idle_time | Minimum idle time in milliseconds for a message to be eligible for claiming via XAUTOCLAIM. Messages that have been pending (unacknowledged) for at least this duration can be reclaimed by this consumer. Only applicable when using consumer groups. https://redis.io/docs/latest/commands/xautoclaim/ TYPE: |
declare | Whether to create the stream when creating a consumer group. TYPE: |
claim_min_idle_time | Redis 8.4+ https://redis.io/docs/latest/commands/xreadgroup/#the-claim-option TYPE: |
Source code in faststream/redis/schemas/stream_sub.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |