40 Commits

Author SHA1 Message Date
Andreas Jaeger
e44c988306 Remove six usage
Remove six, the python 2/3 compatibility library. It's not needed
anymore since the repo is python3 only.

Remove a now unneeded hacking test.

Change-Id: I40522c4accb4aaf8115d11fee8b081e2d991cb4d
2020-05-11 10:21:58 +02:00
Gabriele
e804874c50
Implement the transport options
With this feature, it is possible to specialize the parameters to send.
`options = oslo_messaging.TransportOptions(at_least_once=True)`

TransportOptions is used in every single driver,
for example in RabbitMQ driver is used to handle the mandatory flag.

Notes:
  - The idea of creating a new  class TransportOptions is because I'd like
    to have an abstract class not related only to the RPCClient
  - at_least_once is the first parameter, when needed we can add the
    others.

Implements: blueprint transport-options (second point)

The blueprint link is [1]
To test it you can use [2]

1- https://blueprints.launchpad.net/oslo.messaging/+spec/transport-options
2- https://github.com/Gsantomaggio/rabbitmq-utils/
   tree/master/openstack/mandatory_test

Change-Id: I1858e4a990507d3c2bac2ef7fbef75d8c2dbfce2
2019-06-24 16:50:35 +02:00
Gabriele
83266cc6ea
Add transport_options parameter
With this new parameter is possible to pass other parameters
from the client to the drivers.
So it is possible to tune the driver behavior.

For example can be used to send the mandatory flag in RabbitMQ

Note:
  - The transport_options parameter is not actually used (yet).
  - This part of blueprint transport-options  (first part)

Implements: blueprint transport-options
The blueprint link is
https://blueprints.launchpad.net/oslo.messaging/+spec/transport-options

Change-Id: Iff23a9344c2c87259cf36b0d14c0a9fc075a2a72
2019-06-14 15:47:39 +02:00
Hervé Beraud
4f385720d7 Remove log translation and i18n
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

Change-Id: I9ddb6595fc52e46ed8844e39d2fa71029c90b65c
Closes-Bug: #1674567
2019-04-24 11:55:38 +02:00
ZhijunWei
cb902e5aff Update hacking version
update the hacking to latest, duo to[1]

[1]: https://github.com/openstack/oslo.messaging/blob/master/HACKING.rst

Change-Id: I1ee7387272690f0de0d7b1937d7c2b0ee404063c
2019-01-21 19:45:42 -05:00
Mehdi Abaakouk
172cfb33f3 Fix oslo.messaging default transport
Change d3f6ca0b47e2a5a3413b27617d9655f02b191c6a have broken
oslo.messaging defaults, no more transport are selected by default and
oslo.messaging just crash:

    Traceback (most recent call last):
      File "/home/sileht/workspace/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
        return func(*args, **keywargs)
      File "oslo_messaging/tests/test_transport.py", line 111, in test_get_transport
        transport_ = oslo_messaging.get_transport(self.conf, **kwargs)
      File "/home/sileht/workspace/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/debtcollector/removals.py", line 242, in wrapper
        return f(*args, **kwargs)
      File "oslo_messaging/transport.py", line 247, in get_transport
        transport_cls=RPCTransport)
      File "oslo_messaging/transport.py", line 205, in _get_transport
        url.transport.split('+')[0],
    AttributeError: 'NoneType' object has no attribute 'split'

This change restores rabbit:// as default.

Change-Id: I945a2aca60347dad672cc406cd33e80e93c588a7
2018-10-05 15:21:45 +02:00
Steve Kowalik
d3f6ca0b47 Remove rpc_backend and ConfFixture.transport_driver
Now that most projects have transitioned from using
ConfFixture.transport_driver, we can remove it and rpc_backend as a
whole. rpc_backend was first deprecated in 5.10.0, released during
Ocata.

Closes-Bug: #1712399
Change-Id: I193cc0e613459a6dbbfd54ed0901a54ded78d712
2018-09-13 15:01:27 -06:00
Andy Smith
f2fd8d4375 Remove the deprecated ZeroMQ driver
Users of the oslo.messaging RPC communications service must use
the rabbit ("rabbit://...") or AMQP 1.0 ("amqp://...") drivers.

Change-Id: If3474142f1fe99d41d7b4466061ed0e23ca38549
Closes-Bug: 1789259
2018-08-28 16:00:50 -04:00
Steve Kowalik
e55f419017 Remove transport aliases support
To facilitate removing rpc_backend support, disentangle the aliases
code by removing it to simplify the code and the tests. Aliases were
first depreacted in 5.20.0 during Pike.

Change-Id: I7d80cd050ce1eca2c6b6c38f0fac29d090b90bf3
Closes-Bug: #1424728
2018-07-05 15:58:05 +10:00
Dan Smith
b34ab8b1cc [rabbitmq] Implement active call monitoring
This adds an optional call_monitor_timeout parameter to the RPC client,
which if specified, will enable heartbeating of long-running calls by
the server. This enables the user to increase the regular timeout to
a much larger value, allowing calls to take a very long time, but
with heartbeating to indicate that they are still running on the server
side. If the server stops heartbeating, then the call_monitor_timeout
takes over and we fail with the usual MessagingTimeout instead of waiting
for the longer overall timeout to expire.

Change-Id: I60334aaf019f177a984583528b71d00859d31f84
2018-05-09 10:08:37 -07:00
Ben Nemec
d925e112b5 Flesh out transport_url help
This is a complicated config opt and the single line help text
doesn't provide anywhere near enough detail for a user to properly
configure it.  This change adds the expected format from the
TransportURL docstring and leaves a link to the docs for that
class since the full details are probably too verbose to put in the
help text in their entirety.

Change-Id: I66122bf9c619d35bcb3caadfde9c0dcdb5cd9095
2017-10-06 20:04:34 +00:00
Rajath Agasthya
03b6f18f80 Warn when wrong transport instance is used
Since RPC and notifications can have different backends, it is
useful to warn users if they use a notification transport in RPC
and vice versa. This patch introduces RPCTransport and
NotificationTransport subclasses of Transport, so it's easier to
add different behavior for them if need be.

Related-Bug: #1680192
Change-Id: Iab60544d69053c8e74c28a2d5c84665be749013f
2017-09-11 07:07:30 -07:00
Kenneth Giusti
c7d880c33a Clean up the TransportURL documentation
Be specific regarding which characters can be used in the 'username'
and 'password' fields of the URL.

Change-Id: I9a2a801b3dd86fceffb05f4d52c715748c88d0cb
Closes-Bug: #1693967
2017-06-01 15:43:03 -04:00
Andrew Smith
ec4d6639bc Add get_rpc_transport call
The get_rpc_transport wraps get_transport to unify the API in
anticipation of comprehensive separation of RPC and Notification
messaging backends.

Related-Bug: 1680192
Change-Id: Ic6af07b98ff43806c2af38a3ba129991f1e0ec86
2017-05-12 12:30:41 -04:00
Mehdi Abaakouk
7a6474662d Fix aliases deprecation
We log deprecation message even if application doesn't use it.
And we missing the parse method.

This change fixes that.

Change-Id: I476816cb14ac8218feb74e8459cfa5f18fdb6c61
2017-04-27 12:22:52 +02:00
Jenkins
62a9370607 Merge "Break user credentials from host at the rightmost '@'" 2017-04-03 16:25:47 +00:00
Kenneth Giusti
d7775859b4 Break user credentials from host at the rightmost '@'
The rightmost '@' in a url netloc field separates the user:password
from the hostname:port.  Using the first may cause the separation to
occur in the username or password field (if unencoded).

Change-Id: I7b02d8e0cbdf875ea80a55065ce98fa73696e05f
Closes-Bug: 1675423
2017-03-23 15:36:27 -04:00
ChangBo Guo(gcb)
5a7dcadc94 Deprecate parameter aliases
oslo.messaging deprecated transport aliases[1] since 5.2.0+
that is the minimal version supported for stable/newton.
This commit deprecates aliases kwargs of TransportURL() and
get_transport(), then we can remove the parameter aliases
in the future version.

Related-Bug: #1424728

[1]I314cefa5fb1803fa7e21e3e34300e5ced31bba89

Change-Id: I0c96979dacd9eb05b4215c687b5e34e7b3475ddb
2017-03-20 17:01:01 +08:00
Jenkins
9efdc374e8 Merge "Register opts if we're going to check conf.transport_url in parse()" 2016-12-02 18:52:37 +00:00
Mehdi Abaakouk
9d55749c05 Fix transport url with empty port
When transport url is set to something like "amqp://hostname:/"
it currently raise ValueError while any url parsing library
(like urlparse) just ignore the port, and don't fail since this is a
value url.

This change make the transport url ignore empty port instead of raising
ValueError.

Change-Id: I04df76012e3b133eddbcf365363cd261d277e369
2016-12-02 10:06:30 +00:00
Dan Smith
485986d5ae Register opts if we're going to check conf.transport_url in parse()
In TransportURL.parse(), a classmethod, we expect conf.transport_url
to be accessible if a url is not passed in. However, since the
_transport_opts are not registered yet, that will fail, which is
a pretty easy case to hit if we're constructing our TransportURL
for the first time on startup.

This registers the opts if we're likely to hit it.

Change-Id: Id94bc0a7fec3ce536e134d4f162ac253a775b238
2016-11-28 14:16:39 -08:00
Li-zhigang
ea8fad47a5 Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve iterators.
We can use dict.items instead, as it will return iterators in PY3 as well.
And dict.items/keys will more readable. 2.In py2, the performance about
list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ia235afc3532f62f265f91ca46d2306c72fc2a2a2
2016-11-23 09:02:14 +00:00
ChangBo Guo(gcb)
34122ee3cb Add warning when credential is not specified for each host
User may not set username/password for each host in config
option transport_url. All hosts should have username/password,
or no host have username/password at the same time.
This commit adds warning if user doesn't set properly.

Closes-Bug: #1595965
Change-Id: I4e204ce8365274566064168a2ba02c3278579717
2016-08-14 00:03:05 +08:00
Gevorg Davoian
282cbc222e Add query paramereters to TransportURL
This patch proposes to allow TransportURLs to have query parameters
with driver-specific options which may override corresponding
values from a static configuration. As an example, the patch
implements this possibility in the pika driver. If the idea is
approved, it will be possible to also implement it in the other
drivers.

Change-Id: Ibb7e13b4509fde035a3c334cde9bc4c498f92140
2016-06-09 16:05:36 +03:00
Jenkins
acb398e317 Merge "Modify the TransportURL's docstrings" 2016-05-26 14:00:19 +00:00
JiaJunsu
5fb8f269e7 Modify the TransportURL's docstrings
To match the test_urls.TestParseURL multi_creds

Change-Id: I4a37b7bce3703aa581bc46d41690bf7978f813a6
Close-Bug: #1529310
2016-05-24 11:37:16 +00:00
Mehdi Abaakouk
4d0f7ab652 deprecate usage of transport aliases
This change starts the deprecation process for the transport aliases.

The first step is deprecate this one cycle. To ensure deployer have
updated they configuration during Newton Then in Octacia we will deprecate
'aliases' kwargs of transportURL() and get_transport() for consuming
application.

Related-bug: #1424728

Change-Id: I314cefa5fb1803fa7e21e3e34300e5ced31bba89
2016-05-23 16:05:57 +00:00
Jenkins
2c24d29fa9 Merge "Make TransportURL.parse aware of transport_url" 2016-05-18 10:08:22 +00:00
Mehdi Abaakouk
6726025630 Make TransportURL.parse aware of transport_url
For no real reason, the transport_url confi option was not read by the
TransportURL class while other config options are read directly from
configuration. Instead the transport_url was always passed to
TransportURL.parse().

This change allows url to be optional for TransportURL.parse() and read
the url from transport_url config when not provided.

Change-Id: Idfe9aa37bf3a409d2c1f76d99ea3d2bdf9837193
2016-05-18 09:28:25 +02:00
Mehdi Abaakouk
2f0d53ba68 rabbit: Deprecates host, port, auth options
We keep backward compatibily of this options since the begin
of oslo.messaging while other driver get theses options trough
the TransportURL.

This changes mark them as deprecated.

Change-Id: I8009c0512f3d7864d2699abf8335bcded259fa02
2016-05-18 09:28:20 +02:00
Jenkins
60a7a893bc Merge "Add parse.unquote to transport_url" 2016-05-14 14:42:44 +00:00
JiaJunsu
2aab5a6370 Add parse.unquote to transport_url
To support special chars in username:password and vhost

Closes-Bug: #1557496

Change-Id: I977bce06c6b1bb71162d49de82a6a3d62df3e6bd
2016-05-07 05:55:12 -07:00
Dmitriy Ukhlov
6db00c77b0 Refactor base interfaces
1) Add MessageHandler base interface for on_incoming_callback replacement
2) Move message_handler parameter form Listener's __init__() to start()
3) Remove wait method from listener

Change-Id: Id414446817e3d2ff67b815074d042a9ce637ec24
2016-04-20 20:46:28 +00:00
Jenkins
55c0b3b52f Merge "Make transport_url config option secret" 2016-04-07 15:05:23 +00:00
Juan Antonio Osorio Robles
cbaf71edfa Make transport_url config option secret
The transport_url may contain credentials to the message queue; For
this reason, this option should be secret for it to not leak into the
logs.

Closes-Bug: #1567233

Change-Id: I49c641a2662976d7220e4222e3c4a4d2586b1336
2016-04-07 05:43:18 +00:00
Dmitriy Ukhlov
5d7d7253d1 Refactor driver's listener interface
Current Listener interface has poll() method which return messages

To use it we need have poller thread which is located in MessageHandlerServer
But my investigations of existing driver's code shows that some implemetations have
its own thread inside for processing connection event loop. This event loop received
messages and store in queue object. And then our poller's thread reads this queue
This situation can be improved. we can remove poller's thread, remove queue object
and just call on_message server's callback from connection eventloop thread

This path provide posibility to do this for one of drivers and leave as is other drivers

Change-Id: I3e3d4369d8fdadcecf079d10af58b1e4f5616047
2016-04-05 18:08:08 +00:00
Flavio Percoco
925eb734a9 Remove qpidd's driver from the tree
Back in liberty we marked this driver as deprecated. This patch removes
it from the tree. The patch also removes tests, options and other
references in the documentation. Note that one script is being kept
because it's required by the amqp driver.

Depends-On: If4b1773334e424d1f4a4e112bd1f10aca62682a9
Change-Id: I4a9cba314c4a2f24307504fa7b5427424268b114
2015-11-20 18:43:28 +00:00
Cyril Roelandt
9e5fb5697d Remove a useless statement
This statement is useless since both 'username' and 'password' are set to None
in the for loop, and that they are not used outside of the loop.

Removing this line also help us getting rid of a false positive thrown by
bandit.

Change-Id: I2aa1a16f30928b77aa40c5a900e35b7bf752658a
2015-10-23 20:07:39 +02:00
Doug Hellmann
ee31a84719 Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages
2015-01-21 21:09:33 -05:00
Doug Hellmann
e55a83e832 Move files out of the namespace package
Move the public API out of oslo.messaging to oslo_messaging. Retain
the ability to import from the old namespace package for backwards
compatibility for this release cycle.

bp/drop-namespace-packages

Co-authored-by: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
Change-Id: Ia562010c152a214f1c0fed767c82022c7c2c52e7
2015-01-12 12:50:41 -05:00