docs: Subscribing events using registry decorator
We supports using registry decorators to subscribe events, this patch add it in our guide. TrivialFix Change-Id: Iaf3a6712aecd063b8cc272b31e374af35347c03f
This commit is contained in:
parent
ca47ee87e6
commit
bf69a299dd
|
@ -456,6 +456,17 @@ The output is:
|
|||
Notifying...
|
||||
|
||||
|
||||
Subscribing events using registry decorator
|
||||
-------------------------------------------
|
||||
|
||||
Now neutron-lib supports using registry decorators to subscribe events.
|
||||
There are two decorators ``has_registry_receivers``, which sets up the
|
||||
class ``__new__`` method to subscribe the bound method in the callback registry
|
||||
after object instantiation. ``receives`` use to decorate callback method
|
||||
which must defines the resource and events.
|
||||
Any class use ``receives`` must be decorated with ``has_registry_receivers``.
|
||||
|
||||
|
||||
Testing with callbacks
|
||||
----------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue