Allow to configure pool name for notifications

enable it by default with pool name 'barbican'.

Also, suashed in is Icc74d5e9327e3cf298ce96194920d4b922d4a07a
Unhardcode keystone listener topic

Change-Id: Id109c34b4ac0ae0250a28b570768ea64b074a173
Related-Issue: PROD-31028
(cherry picked from commit 65e241f3d52033edf8c5a27f481b2578d8edbd9f)
diff --git a/README.rst b/README.rst
index 47f3e6d..4e6800c 100644
--- a/README.rst
+++ b/README.rst
@@ -145,19 +145,36 @@
 
 To enable keystone notification listener, set the `ks_notification_enable`
 to true.
+
 `ks_notifications_allow_requeue` enables requeue feature in case of
 notification processing error. Enable this only when underlying transport
 supports this feature.
 
+`ks_notifications_topic` (defaults to 'notifications') allows to set
+name of the topic to listen for Keystone notifications on. Note that Keystone
+must also be configured to send notifications to this topic.
+If Barbican version and messaging back end support listener pooling,
+it is preferable to leave this value as default and use
+`ks_notifications_pool_name` (see below).
+
+`ks_notifications_pool_name` (Since Queens release) allows to use keystone
+listener together with other applications listening on the same notifications
+topic without interference between services.
+Set it to any distinctive value to enable listener pooling.
+It is enabled by default with pool name 'barbican'.
+Disable it (by setting to empty string) only if underlying messaging transport
+does not support this feature or Barbican is the sole service listening for
+notifications on `ks_notifications_topic` (default is 'notifications') topic.
 
 .. code-block:: yaml
 
     barbican:
       server:
         enabled: true
-        version: ocata
+        version: queens
         ks_notifications_enable: true
         ks_notifications_allow_requeue: true
+        ks_notifications_pool_name: barbican
 
 
 MySQL server has gone away
diff --git a/barbican/files/ocata/barbican.conf.Debian b/barbican/files/ocata/barbican.conf.Debian
index 0c17305..3564a43 100644
--- a/barbican/files/ocata/barbican.conf.Debian
+++ b/barbican/files/ocata/barbican.conf.Debian
@@ -264,7 +264,7 @@
 # of the servers in a round-robin fashion. That's why Barbican service should
 # have its own dedicated notification queue so that it receives all of Keystone
 # notifications.
-topic = 'notifications'
+topic = {{ server.get('ks_notifications_topic', 'notifications') }}
 
 # True enables requeue feature in case of notification processing error.
 # Enable this only when underlying transport supports this feature.
diff --git a/barbican/files/pike/barbican.conf.Debian b/barbican/files/pike/barbican.conf.Debian
index c132ee8..ccebc39 100644
--- a/barbican/files/pike/barbican.conf.Debian
+++ b/barbican/files/pike/barbican.conf.Debian
@@ -294,7 +294,7 @@
 # of the servers in a round-robin fashion. That's why Barbican service should
 # have its own dedicated notification queue so that it receives all of Keystone
 # notifications.
-topic = 'notifications'
+topic = {{ server.get('ks_notifications_topic', 'notifications') }}
 
 # True enables requeue feature in case of notification processing error.
 # Enable this only when underlying transport supports this feature.
diff --git a/barbican/files/queens/barbican.conf.Debian b/barbican/files/queens/barbican.conf.Debian
index 3958f8e..6c19844 100644
--- a/barbican/files/queens/barbican.conf.Debian
+++ b/barbican/files/queens/barbican.conf.Debian
@@ -245,7 +245,20 @@
 # fashion. That's why Barbican service should have its own dedicated
 # notification queue so that it receives all of Keystone
 # notifications. (string value)
-#topic = notifications
+# Alternatively if the chosen oslo.messaging backend
+# supports listener pooling (for example rabbitmq), setting a non-
+# default 'pool_name' option should be preferred. (string value)
+topic = {{ server.get('ks_notifications_topic', 'notifications') }}
+
+# Pool name for notifications listener. Setting this to a distinctive
+# value will allow barbican notifications listener to receive its own
+# copy of all messages from the topic without without interfering with
+# other services listening on the same topic. This feature is
+# supported only by some oslo.messaging backends (in particilar by
+# rabbitmq) and for those it is preferrable to use it instead of
+# separate notification topic for barbican. (string value)
+#pool_name = <None>
+pool_name = {{ server.get('ks_notifications_pool_name', 'barbican') }}
 
 # True enables requeue feature in case of notification processing
 # error. Enable this only when underlying transport supports this