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
* add i18n support to some exception messages
* remove the return value of DecayingTimer.start()
Relates to review: I898a236a384b3466147026abc7a1ee21801e8ca1
Change-Id: I7adf5478732f1f46db1009b059b66ff8af6ecdc3
It's up to the driver to set a suitable timeout for polling the broker,
this one can be different that the one requested by the driver
caller as long as the caller timeout is respected.
This change also adds a new driver listener API, to be able
to stop it cleanly, specially in case of timeout=None.
Closes bug: #1400268
Closes bug: #1399257
Change-Id: I674c0def1efb420c293897d49683593a0b10e291
The iterconsume always set the timeout of kombu to 1 second
even the requested timeout more precise or < 1 second.
This change fixes that.
Related bug: #1400268
Related bug: #1399257
Change-Id: I157dab80cdb4afcf9a5f26fa900f96f0696db502
This change reintroduces the fake_rabbit only for backward compatibility,
but mark it as deprecated.
Now, to use the kombu in-memory driver (that is not thread safe) we must
set the transport_url config option to 'kombu+memory:////" or the
rpc_backend to kombu+memory.
Or we can use the fake driver of oslo.messaging by setting the
transport_url to 'fake:///' or the rpc_backend to 'fake'
This is effectively reverting commit bcb3b23b8f.
Closes-bug: #1399085
Change-Id: I7b6fb3811fc6f695f75ecd350e04e69afd26c428
The iterconsume method of the rabbit driver must
honor timeout parameter when reconnection to the broker
occurs.
Change-Id: I666d818449750c6bae9dde02f519842687a8e4fa
This removes a TODO and also fixes a issue due to the
global state of oslo.config.cfg.CONF.
Closes bug: #1397339
Change-Id: Ib366f35678f899fda93821e6f07897baf8f631b4
Each driver instance must use it's own connection pool.
This removes the last global state of qpid and rabbitmq driver
Make the relation between classes more simple.
The previous behavior was not very safe, as explained in the bug report.
And also, this is a first step to replace this custom connection pool
handling by the kombu one.
Closes bug: #1397925
Partial bug: #1397339
Change-Id: Iecd2b39c76417d9ac081d46810f72eb6e38edfda
This change warns the library consumer when the process if forked and
we can't be sure that the library work as expected.
This also add some documentation about forking oslo.messaging Transport
object.
Change-Id: I2938421775aa72866adac198d70214856d45e165
Related-bug: #1330199
Retry Queue creation to workaround race condition
that may happen when both the client and broker race over
exchange creation and deletion respectively which happen only
when the Queue/Exchange were created with auto-delete flag.
Queues/Exchange declared with auto-delete instruct the Broker to
delete the Queue when the last Consumer disconnect from it, and
the Exchange when the last Queue is deleted from this Exchange.
Now in a RabbitMQ cluster setup, if the cluster node that we are
connected to go down, 2 things will happen:
1. From RabbitMQ side, the Queues w/ auto-delete will be deleted
from the other cluster nodes and then the Exchanges that the
Queues are bind to if they were also created w/ auto-delete.
2. From client side, client will reconnect to another cluster
node and call queue.declare() which create Exchanges then
Queues then Binding in that order.
Now in a happy path the queues/exchanges will be deleted from the
broker before client start re-creating them again, but it also
possible that the client first start by creating queues/exchange
as part of the queue.declare() call, which are no-op operations
b/c they alreay existed, but before it could bind Queue to
Exchange, RabbitMQ nodes just received the 'signal' that the
queue doesn't have any consumer so it should be delete, and the
same with exchanges, which will lead to binding fail with
NotFound error.
Illustration of the time line from Client and RabbitMQ cluster
respectively when the race condition happen:
e-declare(E) q-declare(Q) q-bind(Q, E)
-----+------------------+----------------+----------->
e-delete(E)
------------------------------+---------------------->
Change-Id: Ideb73af6f246a8282780cdb204d675d5d4555bf0
Closes-Bug: #1318721
The PROTOCOL_SSLv3 should not be used, as it can be exploited with
a protocol downgrade attack. Also, its support has been removed in
Debian, so it simply doesn't work at all now in Sid.
This patch removes PROTOCOL_SSLv3 from one of the possible protocols
used by oslo.messaging.
Closes-Bug: #1395095
Change-Id: I2c1977c3bfc1923bcb03744e909f2e70c7fdb14c
The rabbit driver have a custom code to reconnect to a broker,
to change the broker in HA configuration, to retry a to send
a message, to handle the interval between reconnection.
But all of that exists in kombu, so just use it.
Using the kombu Connection object with the url make also the rabbit
driver more generic.
Futher patches can rename rabbit* oslo.config options to a more generic
name and add a new driver entry_point 'kombu' to allow to use this driver
with any borker supported by kombu.
Change-Id: Id6b89d5448126ca652b46fe6ce5a9b3ed5839795
Follow oslo.config conventions for consistency of help strings:
* Use sentence style capitalization.
* End entry with a "."
Fix capitalization of AMQP.
Change-Id: I0a6b170a2a7cfa539e06781f4495c4353d22e4d0
This patch enables running all the unit tests (except the qpid ones that
are skipped) under Python 3.3 and Python 3.4.
Change-Id: I711663b4eedfb3cdeea7e6da7d28c6b92663e611
Instead of the lambda method _ the method should be imported
from oslo.messaging.openstack.common.gettextutils.
Change-Id: I373337cc1227b0d7b7bf93603b53a64de83721a9
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this.
Change-Id: I67cc0774a65886ef9fce0b72e52157b622248a85
Closes-Bug: #1327473
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.
Change-Id: I4a7ce6916aefb2f2d445f0ebd977c824b1c51e24
Partial-Bug: #1321274
If one has the credentials misconfigured for rabbitmq currently the following
error message is shown: "AMQP server on 10.0.0.23:5672 is unreachable:
Socket closed. Trying again in 1 seconds. " This is confusing because the
problem is the login creditentials are wrong but the server can be reached.
Since the rabbmitmq server allowed the initial connection and closed the
socket it's likely an authenication issue. This patch now logs: "AMQP server
10.0.0.23:5672 closed the connection. Check login credentials: Socket closed"
to hint the user that it could be a credential issue.
Change-Id: Iadff35d88a9cf704c1edd2d5036a113966db3ea3
Closes-bug: 1325750
Having an *args list following the retry kwargs just screams:
SyntaxError: non-keyword arg after keyword arg
but we don't actually pass any args to methods invoked via ensure() so
these are just unused and can be removed. If we did want them in future
we could just use functools.partial().
Change-Id: Idef12bbc94d39c84ee06ddd6d743f3d2f705a8d1
When a rpc client try to make a RPC call and the server is unreachable
The rpc call hang until the server come back.
In most case this is the desired behavior.
But sometimes, we can prefer that the library raise an exception after a
certain number of retries.
For example in ceilometer, when publishing a
storage.objects.incoming.bytes sample from the Swift middleware to an
AMQP topic, you might not want to block the Swift client if the AMQP broker
is unavailable - instead, you might have a queueing policy whereby
if a single reconection attempt fails we queue the sample in memory and
try again when another sample is to be published.
This patch is the oslo.messaging part that allow this.
Closes bug #1282639
Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com>
Change-Id: I32086d0abf141c368343bf225d4b021da496c020
This change remove the hack to set the default exchange of a transport in the
amqp driver, by removing the usage of the configuration object to get the
default exchange in rabbit and qpid driver, and instead use the value
passed to the driver constructor into all amqp publishers and consumers
class/method that needs it.
Closes-bug: #1256345
Change-Id: Iba54ca79a49f8545854205c1451b2403735c1006
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.
Change-Id: I4af4a45a56b1364a2f5196b75cff299d607ab393
Partial-Bug: #1317950
gettextutils is expecting to receive unicode strings
rather than basestrings. A basestring can cause an
unhandled exception in the logging code. To help avoid
such issues we should remove str() from LOG.* messages and
exceptions. We have verified that the %s formatting code
properly handle getting strings to unicode where necessary.
Copied from https://review.openstack.org/#/c/77722
Change-Id: I082af5c9ae8bf9859382c2c387b10b48358e10b3
Related-Bug: #1286306
This patch add the support of multiple hosts in transport url for rabbit and
qpid drivers. And also fix the amqp connection pool management to allow
to have one pool by transport.
Implements blueprint multiple-hosts-support-in-url
Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com>
Change-Id: I5aff24d292b67a7b65e33e7083e245efbbe82024
The rule of choosing AMQP message broker is that chose first
available one in order now. The order depends on what we set in
configuration file. That means all the connections will flock
to same message broker and that may lead out performance issue.
This patch randomizes the order of choosing message broker for
each connection to leverage broker cluster.
Change-Id: Ib5098e574d4ef81428065885e2295d0f87aba715
Partial-Bug: #1261631
There is a hacking review https://review.openstack.org/#/c/74493/.
That makes me be aware we maybe have rendunant parentheses.
We'd better clean the parentheses, Python will handle that well.
Change-Id: Ib29f995feed45d71000f333a2cc7d14b0efcb0d5
sslutils is the only oslo-incubator module we use which registers any
config options, and we don't even use those config options at runtime.
The problem with us using oslo-incubator config options is that they
need to be exactly in sync with the oslo-incubator version of those
used by every project using oslo.messaging.
Avoid all this be inlining validate_ssl_version() until we have it
available in a real library.
Change-Id: Id3b0bb2e7ede33ede9b66025d1af113ae60cfc58
Closes-Bug: #1287542
In commit d8d2ad9 we added support for notification listener endpoint
methods to return REQUEUE, but if a driver does not support this we
raise NotImplementedError when the application attempts to requeue
a message.
This requeuing behaviour might only be used by an application in
unusual, exceptional circumstances and catch users by surprise.
Instead, let's require the application to assert that it needs this
feature in advance and raise NotImplementError at that point if the
driver doesn't support it.
Change-Id: Id0bb0e57d2dcc1ec7d752e98c9b1e8e48d99f35c
This patch allow to requeue the notification received by the
notification listener.
Partial implements blueprint notification-subscriber-server
Change-Id: I49c4ba91224c280e479edb19289ccb337a2ab843