Open johanjk opened 8 months ago
Seems like a good idea, but you can't use @broker.publisher(...)
without @broker.subscriber(...)
. So, the valid case should looks like
@broker.subscriber("in")
@broker.publisher("out")
async def handler(...):
yield from iterbale_interactor(...)
It should publishes N messages at 1 consumer call
I would in fact also like publisher
to be usable standalone.
In my example I am scheduling it in the background using asyncio.create_task
as part of lifespan
with the help of my "workaround" pub
decorator.
You can use publisher.publish
interface alone
I don't like an idea to create publish side-effect on original function call, so all interfaces can be used only in explicit way: @broker.publisher(...)
only with @broker.subscriber(...)
, publisher.publish(...)
- in other cases
I have a yielding generator that produces msgs into a topic.
I wish the following syntax was valid:
Current workaround