shellbot.speaker module¶
-
class
shellbot.speaker.
Speaker
(engine=None)[source]¶ Bases:
multiprocessing.process.Process
Sends updates to a business messaging space
-
EMPTY_DELAY
= 0.005¶
-
process
(item)[source]¶ Sends one update to a business messaging space
Parameters: item (str or object) – the update to be transmitted
-
run
()[source]¶ Continuously send updates
This function is looping on items received from the queue, and is handling them one by one in the background.
Processing should be handled in a separate background process, like in the following example:
speaker = Speaker(engine=my_engine) speaker.start()
The recommended way for stopping the process is to change the parameter
general.switch
in the context. For example:engine.set('general.switch', 'off')
Alternatively, the loop is also broken when an exception is pushed to the queue. For example:
engine.mouth.put(None)
-