diff --git a/mistral/config.py b/mistral/config.py index c4d04fbe9..58f291e79 100644 --- a/mistral/config.py +++ b/mistral/config.py @@ -227,6 +227,13 @@ event_engine_opts = [ 'identifier. It is not necessarily a hostname, ' 'FQDN, or IP address.') ), + cfg.HostAddressOpt( + 'listener_pool_name', + default='events', + help=_('Name of the event engine\'s listener pool. This can be an' + ' opaque identifier. It is used for identifying the group' + ' of event engine listeners in oslo.messaging.') + ), cfg.StrOpt( 'topic', default='mistral_event_engine', diff --git a/mistral/messaging.py b/mistral/messaging.py index 4707505e9..4e8b68408 100644 --- a/mistral/messaging.py +++ b/mistral/messaging.py @@ -18,8 +18,8 @@ AMQP messages based on olso.messaging framework. """ import abc -import socket +from oslo_config import cfg from oslo_log import log as logging import oslo_messaging from oslo_messaging.notify import dispatcher @@ -30,6 +30,7 @@ from oslo_utils import timeutils import six LOG = logging.getLogger(__name__) +CONF = cfg.CONF def handle_event(self, ctxt, publisher_id, event_type, payload, metadata): @@ -91,7 +92,8 @@ def get_pool_name(exchange): :param exchange: exchange name """ - pool_name = 'mistral-%s-%s' % (exchange, socket.gethostname()) + pool_host = CONF.event_engine.listener_pool_name + pool_name = 'mistral-%s-%s' % (exchange, pool_host) LOG.debug("Listener pool name is %s", pool_name)