Use new get_rpc_client API from oslo.messaging
Use the new get_rpc_client API to handle the RCPClient instantiation. This new API was added into oslo.messaging here [1]. [1] https://review.opendev.org/c/openstack/oslo.messaging/+/862419 Closes-bug: 2011620 Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com> Change-Id: I2322d0bb49b342f8eec49f599257f9dac83b3d8a
This commit is contained in:
parent
0dc361b093
commit
e17699d3d1
@ -102,12 +102,12 @@ class BrokerClientBase(object):
|
|||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, server=server, version=self.broker_endpoint.Version,
|
topic=topic, server=server, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = 2, retry = 0)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = 2, retry = 0)
|
||||||
return queryclient.call({}, api_name, **api_kwargs)
|
return queryclient.call({}, api_name, **api_kwargs)
|
||||||
|
|
||||||
def cast(self, topic, api_name, **api_kwargs):
|
def cast(self, topic, api_name, **api_kwargs):
|
||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target)
|
||||||
queryclient.cast({}, api_name, **api_kwargs)
|
queryclient.cast({}, api_name, **api_kwargs)
|
||||||
|
@ -19,7 +19,7 @@ def setup_client(rpc_endpoint_info, topic, server):
|
|||||||
version=rpc_endpoint_info.Version,
|
version=rpc_endpoint_info.Version,
|
||||||
server=server,
|
server=server,
|
||||||
namespace=rpc_endpoint_info.Namespace)
|
namespace=rpc_endpoint_info.Namespace)
|
||||||
client = oslo_messaging.RPCClient(transport, target)
|
client = oslo_messaging.get_rpc_client(transport, target)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def get_transport(rpc_endpoint_info):
|
def get_transport(rpc_endpoint_info):
|
||||||
|
@ -162,12 +162,12 @@ class BrokerClientBase(object):
|
|||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
# note: the call might stuck here on 'Connection failed' and retry forever
|
# note: the call might stuck here on 'Connection failed' and retry forever
|
||||||
# due to the tcp connection is unreachable: 'AMQP server on <broker host>:<port> is unreachable: timed out'
|
# due to the tcp connection is unreachable: 'AMQP server on <broker host>:<port> is unreachable: timed out'
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry)
|
||||||
return queryclient.call({}, api_name, **api_kwargs)
|
return queryclient.call({}, api_name, **api_kwargs)
|
||||||
|
|
||||||
def cast(self, topic, api_name, timeout=None, retry=None, **api_kwargs):
|
def cast(self, topic, api_name, timeout=None, retry=None, **api_kwargs):
|
||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry)
|
||||||
queryclient.cast({}, api_name, **api_kwargs)
|
queryclient.cast({}, api_name, **api_kwargs)
|
||||||
|
@ -19,7 +19,7 @@ def setup_client(rpc_endpoint_info, topic, server):
|
|||||||
version=rpc_endpoint_info.Version,
|
version=rpc_endpoint_info.Version,
|
||||||
server=server,
|
server=server,
|
||||||
namespace=rpc_endpoint_info.Namespace)
|
namespace=rpc_endpoint_info.Namespace)
|
||||||
client = oslo_messaging.RPCClient(transport, target)
|
client = oslo_messaging.get_rpc_client(transport, target)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def get_transport(rpc_endpoint_info):
|
def get_transport(rpc_endpoint_info):
|
||||||
|
@ -102,12 +102,12 @@ class BrokerClientBase(object):
|
|||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, server=server, version=self.broker_endpoint.Version,
|
topic=topic, server=server, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry)
|
||||||
return queryclient.call({}, api_name, **api_kwargs)
|
return queryclient.call({}, api_name, **api_kwargs)
|
||||||
|
|
||||||
def cast(self, topic, api_name, **api_kwargs):
|
def cast(self, topic, api_name, **api_kwargs):
|
||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target)
|
||||||
queryclient.cast({}, api_name, **api_kwargs)
|
queryclient.cast({}, api_name, **api_kwargs)
|
||||||
|
@ -16,7 +16,7 @@ def setup_client(rpc_endpoint_info, topic, server):
|
|||||||
version=rpc_endpoint_info.Version,
|
version=rpc_endpoint_info.Version,
|
||||||
server=server,
|
server=server,
|
||||||
namespace=rpc_endpoint_info.Namespace)
|
namespace=rpc_endpoint_info.Namespace)
|
||||||
client = oslo_messaging.RPCClient(transport, target)
|
client = oslo_messaging.get_rpc_client(transport, target)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def get_transport(rpc_endpoint_info):
|
def get_transport(rpc_endpoint_info):
|
||||||
|
@ -102,12 +102,12 @@ class BrokerClientBase(object):
|
|||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, server=server, version=self.broker_endpoint.Version,
|
topic=topic, server=server, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry)
|
||||||
return queryclient.call({}, api_name, **api_kwargs)
|
return queryclient.call({}, api_name, **api_kwargs)
|
||||||
|
|
||||||
def cast(self, topic, api_name, **api_kwargs):
|
def cast(self, topic, api_name, **api_kwargs):
|
||||||
target = oslo_messaging.Target(
|
target = oslo_messaging.Target(
|
||||||
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
topic=topic, fanout=True, version=self.broker_endpoint.Version,
|
||||||
namespace=self.broker_endpoint.Namespace)
|
namespace=self.broker_endpoint.Namespace)
|
||||||
queryclient = oslo_messaging.RPCClient(self.transport, target)
|
queryclient = oslo_messaging.get_rpc_client(self.transport, target)
|
||||||
queryclient.cast({}, api_name, **api_kwargs)
|
queryclient.cast({}, api_name, **api_kwargs)
|
||||||
|
@ -16,7 +16,7 @@ def setup_client(rpc_endpoint_info, topic, server):
|
|||||||
version=rpc_endpoint_info.Version,
|
version=rpc_endpoint_info.Version,
|
||||||
server=server,
|
server=server,
|
||||||
namespace=rpc_endpoint_info.Namespace)
|
namespace=rpc_endpoint_info.Namespace)
|
||||||
client = oslo_messaging.RPCClient(transport, target)
|
client = oslo_messaging.get_rpc_client(transport, target)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def get_transport(rpc_endpoint_info):
|
def get_transport(rpc_endpoint_info):
|
||||||
|
@ -107,7 +107,7 @@ target = oslo_messaging.Target(
|
|||||||
fanout=True,
|
fanout=True,
|
||||||
version='1.0', namespace='notification')
|
version='1.0', namespace='notification')
|
||||||
|
|
||||||
client = oslo_messaging.RPCClient(transport, target)
|
client = oslo_messaging.get_rpc_client(transport, target)
|
||||||
LocationInfo = {
|
LocationInfo = {
|
||||||
'NodeName': THIS_NODE_NAME,
|
'NodeName': THIS_NODE_NAME,
|
||||||
'PodIP': THIS_POD_IP,
|
'PodIP': THIS_POD_IP,
|
||||||
|
Loading…
Reference in New Issue
Block a user