64 Commits

Author SHA1 Message Date
Jenkins
e267ba9c01 Merge "qpid: Always auto-delete queue of DirectConsumer" 2014-10-28 20:51:56 +00:00
Mehdi Abaakouk
1640cc1703 qpid: Always auto-delete queue of DirectConsumer
In case of the call()er die, the queue used to reply must be
automatically deleted, otherwise they will never been deleted.

This is done in the same way as the rabbit drivers does,
by enabling auto-delete on this queue.

Change-Id: Ib01981d704b8849e0115791ff90fbb74cbac421f
Closes-Bug: #1374519
2014-09-29 15:18:10 +02:00
Davanum Srinivas
487bbf5b13 Enable oslo.i18n for oslo.messaging
Change-Id: Ic8e05ae4ffe3eb871ae64243c41a9955f47cbe2a
2014-09-24 22:18:50 -04:00
Julien Danjou
8d242bd7ab Switch to oslo.serialization
Change-Id: I24be947cfc2d9ce60e65054e6562e544b1e21195
2014-09-23 14:54:30 +02:00
Davanum Srinivas
ff6c5e95da Add square brackets for ipv6 based hosts
Closes-Bug: #1364837
Change-Id: I8f9702377cc049b74622c2db847ffac3ba946b3a
2014-09-05 14:50:18 +00:00
Julien Danjou
a9ec73f38d Switch to oslo.utils
Change-Id: I262e98d8d03acbe2ff8fee5d607279a669a89e34
2014-08-27 14:14:00 +02:00
Jenkins
a9ce3529de Merge "Replace lambda method _" 2014-08-26 22:58:41 +00:00
Zhi Kun Liu
2464ca0b20 Add parameter to customize Qpid receiver capacity
In Qpid rpc backend, receiver capacity is 1 and is hardcoding.
User can not customize it. This patch adds a parameter to make
user can specify receiver capacity in conf file.

- Reference about Receiver Capacity(Prefetch) from Qpid Doc
By default, receiver requests the next message from the server
in response to each fetch call, resulting in messages being
sent to the receiver one at a time. As in the case of sending,
it is often desirable to avoid this roundtrip for each message.
This can be achieved by allowing the receiver to prefetch messages
in anticipation of fetch calls being made. The receiver needs to
be able to store these prefetched messages, the number it can hold
is controlled by the receivers capacity.

DocImpact

Change-Id: I966b512aba6bdd8e9c5cf65cae01bfd21f04f330
Closes-Bug: #1353914
2014-08-14 05:12:13 +00:00
Christian Berendt
7fdeddaa3b Replace lambda method _
Instead of the lambda method _ the method should be imported
from oslo.messaging.openstack.common.gettextutils.

Change-Id: I373337cc1227b0d7b7bf93603b53a64de83721a9
2014-08-04 14:25:33 +02:00
Christian Berendt
5be1b6a6a9 Enabled hacking checks H305 and H307
* H305  imports not grouped correctly
* H307  like imports should be grouped together

Change-Id: I08dafc4fa150d2213b2bb002da7c9ee0ee517fac
2014-07-17 12:41:21 +02:00
Christian Berendt
59103984bb Replaced 'e.g.' with 'for example'
According to the IBM Style Guide the Latin abbreviation 'e.g.'
should be replace by 'for example'.

Change-Id: I694df5ed62213e29bdf35f781fd6f310b7df77a6
2014-07-06 20:56:11 +02:00
Aaron Rosen
0102aa96e6 Replace usage of str() with six.text_type
Replace using of str with six.text_type as it's able to
handle unicode data.

Change-Id: I38e4378c490d1dad8020312308dd3b6dad8772c0
2014-06-25 20:08:51 +00:00
ChangBo Guo(gcb)
821ee096a6 Removes the use of mutables as default args
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this.

Change-Id: I67cc0774a65886ef9fce0b72e52157b622248a85
Closes-Bug: #1327473
2014-06-21 11:41:36 +08:00
Jenkins
830b00d11c Merge "replace string format arguments with function parameters" 2014-06-20 15:51:58 +00:00
Jenkins
023e5e43f6 Merge "Explicitly name subscription queue for responses" 2014-06-20 15:31:32 +00:00
Christian Berendt
409108c74f replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: I4a7ce6916aefb2f2d445f0ebd977c824b1c51e24
Partial-Bug: #1321274
2014-06-20 14:18:40 +01:00
Mehdi Abaakouk
1ea9c35ab4 Transport reconnection retries for notification
This patch add support of reconnection retries for the
messaging notifier.

Related bug #1282639
Change-Id: Ia30331f8306ff0f6952d83ef42ff8bee6b900427
2014-06-18 18:41:33 +02:00
Mark McLoughlin
d7b85a1492 rabbit/qpid: remove the args/kwargs from ensure()
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
2014-06-13 16:16:18 +01:00
Mehdi Abaakouk
948c05417c Add transport reconnection retries
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
2014-06-13 16:21:59 +02:00
Mehdi Abaakouk
f4da213539 Remove amqp default exchange hack
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
2014-05-28 14:12:30 +02:00
Christian Berendt
a6200c0a00 debug level logs should not be translated
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
2014-05-20 22:57:36 +02:00
Gordon Sim
25f3d9acc3 Explicitly name subscription queue for responses
This prevents response queues being abandoned but still bound to
the exchange with the same key as the newer queue.

Change-Id: Iee0465010a1c6d00e96fb672505688a0f763f86c
Closes-Bug: 1318742
2014-05-20 14:27:06 +01:00
Jenkins
17375f41ce Merge "Full support of multiple hosts in transport url" 2014-05-05 15:46:34 +00:00
ChangBo Guo(gcb)
23edc1b4ce Remove str() from LOG.* and exceptions
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
2014-04-27 10:21:21 +08:00
Mehdi Abaakouk
53b9d741a8 Full support of multiple hosts in transport url
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
2014-04-22 17:02:52 +02:00
Jenkins
dc5cb4a192 Merge "Ensure routing key is specified in the address for a direct producer" 2014-04-17 05:20:51 +00:00
ChangBo Guo(gcb)
8ae1880f7a Select AMQP message broker at random
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
2014-04-12 16:45:29 +08:00
Russell Bryant
bb6f3f11f3 Update ensure()/reconnect() to catch MessagingError
The error handling code that gets connections reset if necessary
caught ConnectionError.  It really needs to catch MessagingError,
which ConnectionError inherits from.  There are other types of
MessagingErrors that may occur, such as InternalError, and they need
to cause the connection to reset, as well.

Closes-bug: #1303890
Change-Id: Ic5082b74a362ded8b35cbc75cf178fe6e0db62d0
2014-04-08 11:44:31 -04:00
Gordon Sim
9e0e85ede8 Ensure routing key is specified in the address for a direct producer
This then matches the address used a direct consumer.

Change-Id: If71f78e50f8a9b3acfd1e9d02c8271f17c4ebee7
Closes-Bug: #1300318
2014-03-31 18:42:57 +01:00
ChangBo Guo(gcb)
af72ad9a92 Refactor AMQP message broker selection
Drop redundant variable, make code more clean.

Partial-Bug: #1261631

Change-Id: I5fd71ce3bcd3a82839204ee1fb130de3a3e1d3ac
2014-03-22 15:47:59 +08:00
Mark McLoughlin
5bd31315c2 notification listener: add allow_requeue param
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
2014-03-03 07:51:18 -08:00
Mehdi Abaakouk
d8d2ad95d7 Allow to requeue the notification message
This patch allow to requeue the notification received by the
notification listener.

Partial implements blueprint notification-subscriber-server

Change-Id: I49c4ba91224c280e479edb19289ccb337a2ab843
2014-03-03 09:27:57 +01:00
Jenkins
7564e2cf47 Merge "User a more accurate max_delay for reconnects" 2014-02-26 02:14:30 +00:00
Jenkins
e9821fe602 Merge "Improve help strings" 2014-02-25 12:40:18 +00:00
Xavier Queralt
8a3744fe05 Pass the session to QpidMessage constructor
The patch in I6e37780cc28737cfd56b6719ec8d9cebbc9bb278 added a new class
for the QpidMessage which was wrongly initialized when processing a
message.

Change-Id: Iaf525fc6ee9e56100c89863f9c651f20c148ecb5
Closes-Bug: 1282038
2014-02-19 12:15:29 +01:00
Flavio Percoco
dc1f984dac User a more accurate max_delay for reconnects
In an HA deployment, a 60 seconds delay between reconnects can be quite
problematic. This patch changes the delay calculation by setting the max
delay to 5s and by changing the way it is increased.

Unfortunately, this is one of the places where both our main drivers are
not consistent. Rabbit's driver uses configuration parameters for this
whereas qpid's driver has never had one. However, I would prefer not
adding configuration paremeters to qpid's driver for the following
reasons:

    1. Most of OpenStack services depend on the messaging layer, hence
    they need it to be available. A 5s delay seems to be reasonable and
    I could argue the need of tune it further. Although so frequent
    reconnects can add load to the network, that wouldn't be the main
    issue if one of the brokers go down.
    2. We're trying to move away from configuration options towards using
    transport URL. This path is still not clear and I would
    prefer avoiding adding new options until we clear it out.

Change-Id: I537015f452eb770acba41fdedfe221628f52a920
Closes-bug: #1281148
2014-02-18 10:56:21 +01:00
Mehdi Abaakouk
0d102aa361 Abstract the acknowledge layer of a message
The patch add ta abstraction layer to acknowledge a message.

Partial implements blueprint notification-subscriber-server

Change-Id: I6e37780cc28737cfd56b6719ec8d9cebbc9bb278
2014-02-14 16:06:26 +01:00
Jenkins
a65f17abbb Merge "Qpid: advance thru the list of brokers on reconnect" 2014-02-10 03:15:11 +00:00
Andreas Jaeger
5a860beb87 Improve help strings
Follow oslo.config style guide for help strings better to create
consistent help strings:
* Capitalize first word of each help string
* Finish help strings with "."

Change-Id: Ia08fa09593661e6e5b834d98bbd92689c2674075
2014-02-07 22:25:09 +01:00
Ihar Hrachyshka
3fdd52e0d4 Qpid: advance thru the list of brokers on reconnect
In Qpid implementation, when using multiple qpid_hosts, we don't want to
immediately retry failed connection for the same failed broker. This was not
the case in existing implementation though, where we've always attempted to
reconnect starting from the first broker in the list of candidates. So if the
first broker failed, we initiated reconnect to the same failed broker.

This change makes reconnect() implementation to select the next broker in the
list. This also means that non-failure reconnect attempts will also switch the
current broker. All in all, users should not rely on any particular order to
use brokers from the list, so this should not constitute an issue.

Change-Id: I257c2ad6d7ebead356c0239134340975da6dbc07
Partial-Bug: 1261631
2014-02-05 15:30:55 +01:00
Jenkins
bf3896d462 Merge "Remove unused eventlet/greenlet from qpid/rabbit" 2014-02-04 20:25:32 +00:00
Ihar Hrachyshka
9ff4d99823 Fix duplicate topic messages for Qpid topology=2
Manually applied ef406a21782134aeefb944f74b3f1a47d6169318 from
oslo-incubator to get the fix required for bug 1257293.

Copying the original commit message from oslo-incubator below.

"""
When multiple RPC servers (consumers) are subscribed to the same RPC
topic, a single RPC request to that topic should be received by only
one of the consumers.  A bug in the QPID driver caused every consumer
to receive a copy of the RPC request.  This bug affects only Topology
version 2.  This patch will cause a single queue to be created for
each topic, and shared among all consumers of that topic.  This
results in each RPC request being received by only one consumer,
in turn across all the competing consumers.
"""

Change-Id: I76bfa5b48bad4a70fbf06b74f4cc8234af6610c2
Closes-bug: #1257293.
2014-01-03 11:15:44 +01:00
Mehdi Abaakouk
0218991a57 Remove unused eventlet/greenlet from qpid/rabbit
Because driver should rely on executor and not directly on eventlet,
delete eventlet/greenlet related code.

qpid/rabbit part.

Change-Id: I20a0850d54b6c6f81957beabb12f7d67f0c1e741
2013-12-19 16:35:57 +01:00
Mehdi Abaakouk
e57a15deb8 Remove eventlet related code in amqp driver
Because driver should rely on executor and not directly on eventlet,
delete eventlet related code. This also drop the old driver API.

This is the amqp part.

Change-Id: Ic6060058dafa4dabbc5e8c68bf231c818a7fec25
2013-12-16 17:30:36 +01:00
Jenkins
77c319d9a9 Merge "Avoid creating qpid connection twice in initialization" 2013-12-09 18:24:06 +00:00
Chang Bo Guo
b38b3a3c13 Replace data structures' attribute with six module
In Python 3, some data structures' attribute is different in Python 2.
See http://pythonhosted.org/six/#object-model-compatibility
This is change mapping:

   six               Python 2           Python 3
six.next(it)         it.next()          next(it)
six.iterkeys(dict)   dict.iterkeys()    dict.keys()
six.itervalues(dict) dict.itervalues()  dict.values()

Implements: blueprint make-python3-compatible
Change-Id: Ida48f39ff230860feee7305b93b134c625a21663
2013-12-09 08:17:59 +00:00
Chang Bo Guo
39d1dde432 Avoid creating qpid connection twice in initialization
In current logic, class impl_qpid.Connnection constructor calls
method connection_create twice indirectly. Let us avoid this.

Change-Id: I7618cf3506d857579dc37b338690d05179ba272d
2013-12-07 19:52:46 -08:00
Mehdi Abaakouk
42ce3ab4b5 Remove the partial implementation of ack_on_error
The ack_on_error is not used by the abstraction layer, and only the
rabbitmq implements it.

This commit remove this feature, and next commit will add a new way for
this.

Partial implements blueprint notification-subscriber-server

Change-Id: I17eb23f2e3e374630251576438011f186e5b2150
2013-12-05 13:49:35 +01:00
Jenkins
e58636c26a Merge "Properly reconnect subscribing clients when QPID broker restarts" 2013-12-05 09:10:27 +00:00
Joe Gordon
5d046a5c97 Remove vim header
No need to set tabstop 189 times, this can be set in your vimrc file
instead.  Also if set incorrectly gate (pep8 check) will catch your
mistakes.

Change-Id: Ic6f0c0ef94e8194a5c121598305d1ec3c74e4843
2013-12-03 15:44:24 +00:00