From bf69a299dd3dbea4477599da1f983cc586d51c45 Mon Sep 17 00:00:00 2001 From: Dongcan Ye Date: Tue, 7 Nov 2017 14:56:09 +0800 Subject: [PATCH] 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 --- doc/source/contributor/callbacks.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/source/contributor/callbacks.rst b/doc/source/contributor/callbacks.rst index 1ce83e689..526dec9b9 100644 --- a/doc/source/contributor/callbacks.rst +++ b/doc/source/contributor/callbacks.rst @@ -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 ----------------------