StreamSub
faststream.redis.schemas.StreamSub #
StreamSub(
stream: str,
polling_interval: int | None = None,
group: str | None = None,
consumer: str | None = None,
batch: Literal[False] = 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,
)
StreamSub(
stream: str,
polling_interval: int | None = None,
group: str | None = None,
consumer: str | None = None,
batch: Literal[True] = ...,
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,
)
StreamSub(
stream: str,
polling_interval: int | None = None,
group: str | None = None,
consumer: str | None = None,
batch: bool = ...,
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,
)
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, Generic[BatchT_co]
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
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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
validate classmethod #
validate(value: None, **kwargs: Any) -> None
Source code in faststream/redis/schemas/stream_sub.py
234 235 236 237 238 239 240 241 | |
add_prefix #
add_prefix(prefix: str) -> Self
Source code in faststream/redis/schemas/stream_sub.py
243 244 245 246 | |