common.examples.asyncq.application module
The application module
- async common.examples.asyncq.application.makeitem(size: int = 5) str
Make a random, hex value to be a payload
- async common.examples.asyncq.application.randsleep(logger, caller=None) None
Makes the caller to sleep for a randomly selected period between 1-3 seconds
- async common.examples.asyncq.application.produce(logger, name: int, queue: Queue) None
Send randomly generated payloads into the queue randomly selected times between 1-5
- async common.examples.asyncq.application.consume(logger, name: int, queue: Queue) None
Consumes the
- class common.examples.asyncq.application.Application(config)
Bases:
ApplicationBase
The Application class
- started = None
- async start()
Starts the application.
- async stop()
Shuts down the application
- async jobs()
Jobs definition of the application.
It will create producers and consumers, that will communicate with each other via an async queue. The producers will randomly select how many messages will send, with how long delay among the sendings.
This will run the producers, until they finish their work, waits until the queue will be empty, then closes the consumers, finally it terminates.