NATS subject overlap understanding #1756
Replies: 1 comment 3 replies
-
Hi, I have create minimal reproducible example from your code with faststream==0.5.20 Codefrom faststream import FastStream
from faststream.nats import NatsBroker, JStream, DeliverPolicy, PullSub, RetentionPolicy, StorageType, NatsMessage
broker = NatsBroker()
app = FastStream(broker)
MOMO_WORKER_DEFAULT = JStream(
name="momo-worker-default",
retention=RetentionPolicy.WORK_QUEUE,
max_age=60 * 60 * 1 * 3,
declare=True,
storage=StorageType.FILE,
allow_direct=False,
)
@broker.subscriber(
"scheduled.bimonthly.organisation.email.summary.send",
durable="bimonthly-organisation-email-summary-send",
stream=MOMO_WORKER_DEFAULT,
max_workers=10,
deliver_policy=DeliverPolicy.ALL,
pull_sub=PullSub(batch_size=10),
)
async def handle_1(msg: NatsMessage):
print(msg)
@broker.subscriber(
"organisation.email.summary.send",
durable="organisation-email-summary-send",
stream=MOMO_WORKER_DEFAULT,
max_workers=10,
deliver_policy=DeliverPolicy.ALL,
pull_sub=PullSub(batch_size=10),
)
async def handle_2(msg: NatsMessage):
print(msg)
@broker.subscriber(
"scheduled.daily.organisation.event.ended.reminder",
durable="daily-organisation-event-ended-reminder",
stream=MOMO_WORKER_DEFAULT,
max_workers=10,
deliver_policy=DeliverPolicy.ALL,
pull_sub=PullSub(batch_size=10)
)
async def handle_3(msg: NatsMessage):
print(msg)
@broker.subscriber(
"organisation.event.ended.reminder",
durable="organisation-event-ended-reminder",
stream=MOMO_WORKER_DEFAULT,
max_workers=10,
deliver_policy=DeliverPolicy.ALL,
pull_sub=PullSub(batch_size=10)
)
async def handle_4(msg: NatsMessage):
print(msg) When I publish message with natscli |
Beta Was this translation helpful? Give feedback.
-
I have these handlers:
All configured like this:
And the stream configured like this
The problem is that with this setup a message with subject
organisation.event.ended.reminder
is never handled. Only if I change the subject toevent.ended.reminder
on the handler and publish it it will be handled.To my understanding the
organisation.email
andorganisation.event
are other "domains" right? So it is not really clear to me why the setup above is not working as expected...Beta Was this translation helpful? Give feedback.
All reactions