NATS subject overlap understanding #1756
theobouwman
started this conversation in
General
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 |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.reminderis never handled. Only if I change the subject toevent.ended.reminderon the handler and publish it it will be handled.To my understanding the
organisation.emailandorganisation.eventare other "domains" right? So it is not really clear to me why the setup above is not working as expected...All reactions