mirror of https://github.com/celery/kombu.git
kombu.pidbox: Fixed rst in docstrings
This commit is contained in:
parent
7706f226f9
commit
3ac397a5e4
|
@ -1,29 +1,40 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Server
|
Creating the applications Mailbox
|
||||||
======
|
=================================
|
||||||
|
|
||||||
mailbox = pidbox.Mailbox("celerybeat", )
|
::
|
||||||
|
|
||||||
@mailbox.handler
|
>>> mailbox = pidbox.Mailbox("celerybeat", type="direct")
|
||||||
def reload_schedule(state, **kwargs):
|
|
||||||
state.beat.reload_schedule()
|
|
||||||
state["last_reload"] = time()
|
|
||||||
|
|
||||||
@mailbox.handler
|
>>> @mailbox.handler
|
||||||
def connection_info(state, **kwargs):
|
>>> def reload_schedule(state, **kwargs):
|
||||||
return {"connection": state.connection.info()}
|
... state["beat"].reload_schedule()
|
||||||
|
|
||||||
|
>>> @mailbox.handler
|
||||||
|
>>> def connection_info(state, **kwargs):
|
||||||
|
... return {"connection": state["connection"].info()}
|
||||||
|
|
||||||
connection = kombu.BrokerConnection()
|
Example Node
|
||||||
mailbox(connection).Node(hostname).consume()
|
============
|
||||||
|
|
||||||
Client
|
::
|
||||||
======
|
>>> connection = kombu.BrokerConnection()
|
||||||
|
>>> state = {"beat": beat,
|
||||||
|
"connection: connection}
|
||||||
|
>>> consumer = mailbox(connection).Node(hostname).listen()
|
||||||
|
>>> try:
|
||||||
|
... while True:
|
||||||
|
... connection.drain_events(timeout=1)
|
||||||
|
... finally:
|
||||||
|
... consumer.cancel()
|
||||||
|
|
||||||
celerybeat = pidbox.lookup("celerybeat")
|
Example Client
|
||||||
celerybeat.cast("reload_schedule")
|
==============
|
||||||
info = celerybeat.call("connection_info", timeout=1)
|
|
||||||
|
::
|
||||||
|
>>> mailbox.cast("reload_schedule") # cast is async.
|
||||||
|
>>> info = celerybeat.call("connection_info", timeout=1)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue