Take DBAAS multi-channel publishing Redis modules into use
Following SDL APIs are defined so that multiple channel-event pairs can be
given as function argument but actual SDL implementation utilized such a DBAAS
(Redis) module what expect to get only one channel-event pair. Fix the
implementation of these SDL APIs to use the correct DBAAS module what support
multiple channel-event pairs:
* set_if_and_publish()
* set_if_not_exists_and_publish()
* remove_if_and_publish()
Please note that in runtime environment DBAAS service needs to run on DBAAS
image version 0.4.0 or newer. Older images do not have multiple channel-event
pairs support as a Redis module.
Updated also start_event_listener() and handle_events() description to
emphasize that channel-event subscription must be done before calling those
functions, otherwise open-source Redis client application could throw an
exception due to not having any subscription when it receives some event, for
example a ping event in case of the DBAAS Sentinel deployment.
Issue-ID: RIC-758
Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I75d4e3316d7387b7a1a735fe3eb357de7ef794bb
diff --git a/ricsdl-package/examples/notify.py b/ricsdl-package/examples/notify.py
index 7d2f203..3041d80 100755
--- a/ricsdl-package/examples/notify.py
+++ b/ricsdl-package/examples/notify.py
@@ -23,11 +23,11 @@
* Following Redis extension commands have been installed to runtime environment:
- MSETPUB
- SETIE
- - SETIEPUB
- - SETNXPUB
- - DELPUB
+ - SETIEMPUB
+ - SETNXMPUB
+ - DELMPUB
- DELIE
- - DELIEPUB
+ - DELIEMPUB
Redis v4.0 or greater is required. Older versions do not support extension modules.
Implementation of above commands is produced by RIC DBaaS:
https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/dbaas
@@ -134,6 +134,9 @@
pass
time.sleep(0.001)
+# Subscribe to MY_CHANNEL. We expect that anytime we receive a message in the
+# channel, cb function will be called.
+_try_func_return(lambda: mysdl.subscribe_channel(MY_NS, cb, MY_CHANNEL))
# As mentioned above, there are two available methods for applications to
# handle notifications
@@ -143,10 +146,6 @@
thread = threading.Thread(target=listen_thread)
thread.start()
-# Subscribe to MY_CHANNEL. We expect that anytime we receive a message in the
-# channel, cb function will be called.
-_try_func_return(lambda: mysdl.subscribe_channel(MY_NS, cb, MY_CHANNEL))
-
# Sets a value 'my_value' for a key 'my_key' under given namespace. Note that value
# type must be bytes and multiple key values can be set in one set function call.
_try_func_callback_return(
diff --git a/ricsdl-package/examples/sync.py b/ricsdl-package/examples/sync.py
old mode 100644
new mode 100755
index 6ea9ef9..1fa5742
--- a/ricsdl-package/examples/sync.py
+++ b/ricsdl-package/examples/sync.py
@@ -25,11 +25,11 @@
* Following Redis extension commands have been installed to runtime environment:
- MSETPUB
- SETIE
- - SETIEPUB
- - SETNXPUB
- - DELPUB
+ - SETIEMPUB
+ - SETNXMPUB
+ - DELMPUB
- DELIE
- - DELIEPUB
+ - DELIEMPUB
Redis v4.0 or greater is required. Older versions do not support extension modules.
Implementation of above commands is produced by RIC DBaaS:
https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/dbaas