diff --git a/doc/source/notification_listener.rst b/doc/source/notification_listener.rst index 00b9ad2b3..4fa06617d 100644 --- a/doc/source/notification_listener.rst +++ b/doc/source/notification_listener.rst @@ -7,3 +7,8 @@ Notification Listener .. currentmodule:: oslo.messaging .. autofunction:: get_notification_listener + +.. autoclass:: MessageHandlingServer + :members: + +.. autofunction:: get_local_context diff --git a/oslo/messaging/_executors/impl_eventlet.py b/oslo/messaging/_executors/impl_eventlet.py index 13eeeb108..02f538547 100644 --- a/oslo/messaging/_executors/impl_eventlet.py +++ b/oslo/messaging/_executors/impl_eventlet.py @@ -13,16 +13,21 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import sys import eventlet +from eventlet.green import threading as greenthreading from eventlet import greenpool import greenlet from oslo.config import cfg from oslo.messaging._executors import base +from oslo.messaging import localcontext from oslo.utils import excutils +LOG = logging.getLogger(__name__) + _eventlet_opts = [ cfg.IntOpt('rpc_thread_pool_size', default=64, @@ -77,6 +82,14 @@ class EventletExecutor(base.ExecutorBase): self._greenpool = greenpool.GreenPool(self.conf.rpc_thread_pool_size) self._running = False + if not isinstance(localcontext._STORE, greenthreading.local): + LOG.debug('eventlet executor in use but the threading module ' + 'has not been monkeypatched or has been ' + 'monkeypatched after the oslo.messaging library ' + 'have been loaded. This will results in unpredictable ' + 'behavior. In the future, we will raise a ' + 'RuntimeException in this case.') + def start(self): if self._thread is not None: return diff --git a/oslo/messaging/notify/listener.py b/oslo/messaging/notify/listener.py index 4e7c184ff..9548d98e2 100644 --- a/oslo/messaging/notify/listener.py +++ b/oslo/messaging/notify/listener.py @@ -110,6 +110,9 @@ def get_notification_listener(transport, targets, endpoints, dispatched. By default, the most simple executor is used - the blocking executor. + If the eventlet executor is used, the threading and time library need to be + monkeypatched. + :param transport: the messaging transport :type transport: Transport :param targets: the exchanges and topics to listen on diff --git a/oslo/messaging/rpc/server.py b/oslo/messaging/rpc/server.py index b4d1315ff..0909e9cdf 100644 --- a/oslo/messaging/rpc/server.py +++ b/oslo/messaging/rpc/server.py @@ -106,6 +106,9 @@ def get_rpc_server(transport, target, endpoints, dispatched. By default, the most simple executor is used - the blocking executor. + If the eventlet executor is used, the threading and time library need to be + monkeypatched. + :param transport: the messaging transport :type transport: Transport :param target: the exchange, topic and server to listen on