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:
Dongcan Ye 2017-11-07 14:56:09 +08:00
parent ca47ee87e6
commit bf69a299dd
1 changed files with 11 additions and 0 deletions

View File

@ -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
----------------------