summaryrefslogtreecommitdiff
path: root/oslo_messaging/rpc/transport.py
diff options
context:
space:
mode:
authorTobias Urdin <tobias.urdin@binero.se>2023-01-12 07:19:46 +0000
committerTobias Urdin <tobias.urdin@binero.com>2023-01-23 08:40:37 +0000
commit687dea2e65814606bece8041fe94fb2674d2590b (patch)
tree37b26793fc539b87ee804f4c9668a9c14708743f /oslo_messaging/rpc/transport.py
parent7505316902d6469842b8c6f84d520ebd2314b7c7 (diff)
downloadoslo-messaging-687dea2e65814606bece8041fe94fb2674d2590b.tar.gz
Support overriding class for get_rpc_* helper functions14.2.0
We currently do not support overriding the class being instantiated in the RPC helper functions, this adds that support so that projects that define their own classes that inherit from oslo.messaging can use the helpers. For example neutron utilizes code from neutron-lib that has it's own RPCClient implementation that inherits from oslo.messaging, in order for them to use for example the get_rpc_client helper they need support to override the class being returned. The alternative would be to modify the internal _manual_load variable which seems counter-productive to extending the API provided to consumers. Change-Id: Ie22f2ee47a4ca3f28a71272ee1ffdb88aaeb7758
Diffstat (limited to 'oslo_messaging/rpc/transport.py')
-rw-r--r--oslo_messaging/rpc/transport.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/oslo_messaging/rpc/transport.py b/oslo_messaging/rpc/transport.py
index 121d617..8f08db5 100644
--- a/oslo_messaging/rpc/transport.py
+++ b/oslo_messaging/rpc/transport.py
@@ -22,7 +22,8 @@ __all__ = [
def get_rpc_transport(conf, url=None,
- allowed_remote_exmods=None):
+ allowed_remote_exmods=None,
+ transport_cls=msg_transport.RPCTransport):
"""A factory method for Transport objects for RPCs.
This method should be used to ensure the correct messaging functionality
@@ -43,7 +44,9 @@ def get_rpc_transport(conf, url=None,
transport will deserialize remote exceptions
from
:type allowed_remote_exmods: list
+ :param transport_cls: the transport class to instantiate
+ :type transport_cls: class
"""
return msg_transport._get_transport(
conf, url, allowed_remote_exmods,
- transport_cls=msg_transport.RPCTransport)
+ transport_cls=transport_cls)