-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression
Description
Observed behavior
When trying to use filter_subjects
(plural), nats.py throws an error claiming that a consumer can't have both FilterSubject and FilterSubjects
BadRequestError: nats: BadRequestError: code=400 err_code=10136 description='consumer cannot haveboth FilterSubject and FilterSubjects specified'
Expected behavior
I'd expect this not to crash, as i don't provide a specific filter_subject
, only filter_subjects
Server and client version
Server: 2.11.6
nats-py: 2.10.0
Host environment
No response
Steps to reproduce
Here's a minimal repro
import nats
import asyncio
from nats.js.api import ConsumerConfig
async def main() -> None:
connection = await nats.connect("localhost:4222")
await connection.jetstream().add_stream(
name="test_stream",
subjects=["test.>"],
)
# Works
await connection.jetstream().subscribe(
subject="test.>",
config=ConsumerConfig(
filter_subject="test.foo",
),
)
# Crashes with "nats.js.errors.BadRequestError: nats: BadRequestError: code=400 err_code=10136 description='consumer cannot have both FilterSubject and FilterSubjects specified'"
await connection.jetstream().subscribe(
subject="test.>",
config=ConsumerConfig(
filter_subjects=["test.foo", "test.bar"],
),
)
asyncio.run(main())
Metadata
Metadata
Assignees
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression