1104 Commits

Author SHA1 Message Date
Victor Sergeyev
c1c0af2069 Don't create a new channel in RabbitMQ Connection.reset()
Current implementation of RabbitMQ driver in in Connection.reset() change
the channel to use and create a new channel for it. This happens after the
each message send.

There no big need to create a new channel each time, so we can cancel all
consumer queues, instead of creating a channel in reset().

Test test_connection_reset_always_succeed() removed, because we are not
create channel on reset() anymore.

Co-Authored-By: Mehdi Abaakouk <sileht@redhat.com>
Change-Id: Ie164840e6c055b01525b13aabdb8b9c7f5d1b98b
2015-05-28 15:32:37 +03:00
Jenkins
baddce34a2 Merge "Adding Publisher Acknowledgements/confirms" 2015-05-28 11:13:11 +00:00
Jenkins
ed432e59c4 Merge "Fix deprecated_group of rpc_conn_pool_size" 2015-05-28 11:00:04 +00:00
OpenStack Proposal Bot
29c3cfaa3c Imported Translations from Transifex
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I8490386a5664b74c2c8d76a7afa632412a9466d9
2015-05-28 06:08:50 +00:00
Jenkins
dda4e698b3 Merge "consumer connections not closed properly" 2015-05-27 16:20:33 +00:00
Davanum Srinivas
cd63a70235 Adding Publisher Acknowledgements/confirms
During the vancouver summit, Michael Klishin from
pivotal proposed we should use publisher confirms
as the default setting to reduce messages being
dropped on the floor.

https://www.rabbitmq.com/confirms.html
http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/

This setting is a lightweight way of keeping track of which messages
have been processed by the broker and which would need re-publishing
in case of broker shutdown or network failure.

Change-Id: I25bc955df130dad4725f5281211d37fd73e7ea63
2015-05-27 16:43:29 +02:00
Jenkins
02fae06de5 Merge "Refactor processing reply in ReplyWaiter" 2015-05-27 13:17:12 +00:00
Mehdi Abaakouk
18c32bc30c Fix deprecated_group of rpc_conn_pool_size
When rpc_conn_pool_size have been moved from amqp.py to base.py:

  87137e7af05f12a99bd04566036fbf71824f45cf

We loose the deprecated_group, this change reintroduces it.

Change-Id: I8cdea7f042afebcc162bafef881ebe61a1cac989
2015-05-27 13:06:40 +02:00
Victor Sergeyev
75cba16d15 Refactor processing reply in ReplyWaiter
At the moment for each msg_id we receive two amqp message - first one
with the payload, a second one to ensure the other have finish to send
the payload. This was made, because a long time ago 'reply' allowed
generator as payload to send multiple messages on one 'rpc.call' - [1]

It's a bad idea - to double RPC messages for each call, so we are going
to remove this the second AMQP message sending. This patch allows
receiver side to proceed correctly old case - two AMQP messages (first
with data and second with 'ending' parameter) same as the new one (a
single message with data 'ending' parameter)

Blueprint: remove-double-reply

[1] - https://github.com/openstack/oslo-incubator/blob/stable/icehouse/openstack/common/rpc/amqp.py#L464

Change-Id: Ic09fe619694c300c4502acb7157d7ecdd47c5fd7
2015-05-27 11:08:17 +03:00
Mehdi Abaakouk
336e3c8f60 rabbit: doc fixes
Change-Id: I945b30ebad35f463220eedc092c7fcd958740bd7
2015-05-27 06:37:54 +00:00
gordon chung
a450841264 consumer connections not closed properly
heartbeat_thread is not set for listeners. when closing connection,
it blindly checks heartbeat_thread and will throw an error causing
connection to remain open. this patch explicitly sets
heartbeat_thread to None.

Change-Id: Ief3bf02f952882ecadf742cdd0bac8edd7812473
Closes-Bug: #1458917
2015-05-26 21:22:16 -04:00
Jenkins
cf98f07f1f Merge "rabbit: smart timeout on missing exchange" 2015-05-26 17:04:30 +00:00
Mehdi Abaakouk
f3d4ba7f6b rabbit: smart timeout on missing exchange
When we send a reply and the exchange is missing, they
no need to wait more that the timeout set by the application.

Change-Id: I7eb19346d72cb0a4813c964df1435d7f4c79e218
2015-05-26 15:06:52 +00:00
gtt116
708d9d842b rabbit: Fix message ttl not work
impl_rabbit set timeout into message's header with {'ttl': (timeout * 1000)},
this mean doesn't work in real, messages still stays in queue after the ttl.

As RabbitMQ document said (http://www.rabbitmq.com/ttl.html#per-message-ttl),
we should passing "expiration" into message's property rather than header to
make it work.

Change-Id: I5d6ae72e69f856c56fb83fb939ed35246716e04d
Closes-bug: #1444854
2015-05-26 16:50:08 +02:00
Jenkins
ecb7803d5f Merge "rabbit: remove publisher classes" 2015-05-26 14:39:20 +00:00
Jenkins
cc42675a15 Merge "Add one more functional test for MessagingTimeout" 2015-05-26 13:39:59 +00:00
Mehdi Abaakouk
ccbe866d32 rabbit: remove publisher classes
Each times we send a message with the rabbit driver we create useless
object that's not more that the kombu exchange and a wrapper method around
the kombu producer.

So, this change just creates the exchange not our useless custom Publisher
and move the wrapped methods into the Connection object.

Change-Id: Id221f4363d897cd904f7aeccbc90cbd288db2db1
2015-05-26 08:51:27 +02:00
Mehdi Abaakouk
77f952a1f7 rabbit: Set timeout on the underlying socket
They are some case where the underlying can be stuck
until the system socket timeout is reached, but in oslo.messaging
we very often known that is not needed to wait for ever because
the upper layer (usualy the application) expect to return after
a certain period.

So this change set the timeout on the underlying socket each we can
determine that is not needed to wait more.

Closes-bug: #1436788
Change-Id: Ie71ab8147c56eaf672585da107bec8b22af9da6c
2015-05-26 08:51:26 +02:00
Davanum Srinivas
8af6b2ff82 Remove stale copy of context.py
Change-Id: I2d09873ddb7a9ef688308cfdbe6deb1959cdd2ac
2015-05-24 03:13:43 +00:00
Jenkins
29c573b3f2 Merge "make it possible to import amqp driver without dependencies" 2015-05-23 01:08:42 +00:00
Victor Sergeyev
cc4ca1f9ef Add one more functional test for MessagingTimeout
Add a check, that MessagingTimeout raises on long-running queries,
if client sends another queries at the same time.

Added a long_running_task() to TestServerEndpoint and allowed to pass a
message executor into the RpcServerFixture.

Related bug: #1338732

Co-Authored-By: Roman Podoliaka <rpodolyaka@mirantis.com>
Change-Id: Icafb6838e2d9fb76b6d1c202465c09c174a3bed9
2015-05-22 16:35:25 +03:00
Victor Sergeyev
3d483fda70 Fix list_opts test to not check all deps
The list_opts entrypoint test failed unnecessarily when the
dependencies in the packages were inconsistent. This test doesn't
need to verify that the dependencies are consistent, only that the
entrypoint is available and provides the expected function.

Change-Id: I0bb0f2b591c402202104af8daf07d56b514cbb2f
2015-05-22 16:30:26 +03:00
Jenkins
7bbd6e4769 Merge "rabbit: fixes a logging issue" 2015-05-17 21:54:11 +00:00
Doug Hellmann
1da2231116 make it possible to import amqp driver without dependencies
All plugins are supposed to be importable without their dependencies so
we can discover options and documentation. Restructure the parts of the
AMQP1 driver that depend on having proton and pyngus installed so the
driver can load without them.

Change-Id: Id0c8c2a6ae44d13f061e651c33efc9e38750a049
2015-05-16 14:21:32 -04:00
Jenkins
7ded4a972f Merge "Remove outdated release notes" 2015-05-15 14:15:51 +00:00
Jenkins
4fa7795f42 Merge "rabbit: smarter declaration of the notif. queue" 2015-05-13 19:54:35 +00:00
Jenkins
cab3f20c36 Merge "rabbit: redeclare consumers when ack/requeue fail" 2015-05-13 19:50:41 +00:00
Mehdi Abaakouk
65fecf2866 Remove outdated release notes
Oslo.messaging have an outdated release in the code tree.
but now the release note is published on the mailing.

This change removes it.

Change-Id: I0a3401b7c9bc8230169e75727e45a99e6c3c780f
2015-05-13 11:19:45 +02:00
Jenkins
cfc28916f9 Merge "Remove support for Python 3.3" 2015-05-12 19:43:45 +00:00
Mehdi Abaakouk
1ba55c03b5 rabbit: smarter declaration of the notif. queue
The NotifyPublisher was redeclaring again and again,
the same exchange and queue each times a notification is sent.

This change fixes that by caching the already declared exchange
and queue for each channel.

Also, to make the test pass. 'Connection.ensure' have been updated
to have the same behavior for amqp and memory driver about
kombu recoverable_errors. And the hostname and port of the memory
driver are set to not fail when we print a log message.

Closes bug: #1437902

Change-Id: I20d133ac67b8a8a4c51d51b6a1b2369aa44ffe2f
2015-05-12 10:19:42 +02:00
Mehdi Abaakouk
415db68b67 rabbit: redeclare consumers when ack/requeue fail
In case the acknowledgement or requeue of a message fail,
the kombu transport can be disconnected

In this case, we must redeclare our consumers.

This changes fixes that.

This have no tests because the kombu memory transport we use in our tests
cannot be in disconnected state.

Closes-bug: #1448650

Change-Id: I5991a4cf827411bc27c857561d97461212a17f40
2015-05-12 10:19:42 +02:00
Mehdi Abaakouk
0c954cffa2 Bump kombu and amqp requirements
We at least need these versions of amqp and kombu to have
a working heartbeat support.

Related-bug: #1436788
Closes-bug: #1436769
Closes-bug: #1408830

Change-Id: I61440c5ccf2b540fe9a1e868bdcae9f5d2cf8422
2015-05-12 10:19:42 +02:00
Jenkins
a5451eed35 Merge "rabbit: fix exception path in queue redeclaration" 2015-05-11 21:12:31 +00:00
Jenkins
445297c2ea Merge "rabbit: fix consumers declaration" 2015-05-11 21:10:28 +00:00
Jenkins
e1e2abaed8 Merge "rabbit: remove unused consumer interfaces" 2015-05-11 21:09:01 +00:00
OpenStack Proposal Bot
48eb5e19cc Updated from global requirements
Change-Id: Idafb42a726b25296d7a44d33361120de4e4bd60b
2015-05-11 15:51:26 +00:00
Mehdi Abaakouk
3c2e9650d1 rabbit: fix exception path in queue redeclaration
This removes a TODO, that was not possible before the consumer code
refactoring.

Now, we can just catch the right exception instead of catching
everything and pray.

Change-Id: Id6203d79d4b2f027e5c6cd952c99fcd0967ecb3c
2015-05-11 08:29:34 +02:00
Mehdi Abaakouk
2c3c8a3a55 rabbit: fix consumers declaration
When a consumer is declared after we have started to consume
amqp, its queue is never consumed.

This fixes that.

Closes bug: #1450342

Change-Id: I9f2e7d83283504dfe762ac88384efde0f7b52d47
2015-05-11 08:29:34 +02:00
Mehdi Abaakouk
b737a92afd rabbit: remove unused consumer interfaces
The consumer code is over engineered, it allows to override
everything, but the override is always done with functools.partial.

None of the child Class have the same signature, sometimes
the constructor use the parameter name as the parent class but for
a different purpose, that makes the code hard to read.

It's was never clear which options is passed to the queue and the
exchange at this end to kombu.

This changes removes all of that stuffs, and only use the kombu
terminology for consumer parameters.

Alse we don't hardcode anymore the tag and the channel in the consumer
class, to allow to change them without recreating a consumer object
in the futur.

Change-Id: Ie341f0c973adbda9a342cb836867345aa42652d1
2015-05-11 08:29:34 +02:00
Mehdi Abaakouk
2d81577fa1 rabbit: remove unused code
We never cancel queues...

Change-Id: Ib83c00971da11b364e7ef19e60c472eaa4e654eb
2015-05-11 08:29:34 +02:00
Mehdi Abaakouk
cca84f66d4 rabbit: Remove unused stuffs from publisher
The publisher code is over engineered, it allows to override
everything, but this is never used.

None of the child Class have the same signature, sometimes
the constructor use the parameter name as the parent class but for
a different purpose, that make the code hard to read.

It's was never clear which options is passed to the queue and the
exchange at this end to kombu.

This changes removes all of that stuffs, and only use the kombu
terminology for publisher parameters.

Change-Id: I3cebf3ed1647a3121dcf33e2160cf315486f5204
2015-05-11 08:29:34 +02:00
Jenkins
87137e7af0 Merge "zmq: Add support for ZmqClient pooling" 2015-05-11 01:49:21 +00:00
Jenkins
c5066c3cc2 Merge "Add RequestContextSerializer" 2015-05-11 01:44:48 +00:00
Davanum Srinivas
6abfdd51da Remove support for Python 3.3
Change-Id: Ifca70a5e139090ae5fd76bd524738bb8c138fd0f
2015-05-10 19:18:41 -04:00
OpenStack Proposal Bot
ef58534877 Updated from global requirements
Change-Id: I8dd4af49c069123bac52fcf312a1ae6e20728e6f
2015-05-07 23:36:42 +00:00
Victor Sergeyev
e888daafee Add RequestContextSerializer
This serializer available (with some differences) in ceilometer,
cinder, designate, heat, ironic, magnum, manila, neutron, nova, trove.
So we can move it to the common code and re-use (or inherit from it) in
OpenStack projects

Change-Id: I0d68b1d98c2214a5d45b65146ac2d19e5f6f5953
2015-05-07 12:07:47 +03:00
OpenStack Proposal Bot
b46e52f536 Updated from global requirements
Change-Id: I3d4e56a47aec37fd69021281aa895b5d3f05ab8c
2015-05-06 16:08:56 +00:00
Mehdi Abaakouk
54ecb3b2c3 rabbit: fixes a logging issue
When uses the default port, kombu.Connection.port is None

So we replace the usage of kombu.Connection.port per
kombu.Connection.info(), to get the default value.

Also some transport driver have 'None' for hostname or port as default
value, so replace usage of '%d' per '%s', to ensure the logging never fail.
Event the output of the log is less sexy.

Change-Id: I89ca1982246146717015253bd4cc26f992381584
Closes-bug: #1452189
2015-05-06 11:11:03 +02:00
Mehdi Abaakouk
6c91066c72 rabbit/qpid: simplify the consumer loop
The consumer loop is over engineered, it returns unused return,
iterconsume creates an iterator directly consumed by 'consume' without
special handling, and in some case kombu error callback are called when
the iterator is stopped and log useless error.

And in reality the consumer is always called when limit=1.

This change simplifies that, by removing the loop and removes all
returns stuffs.

Closes bug: #1450336

Change-Id: Ia2cb52c8577b29e74d4d2b0ed0b535102f2d55c7
2015-05-05 08:26:00 +02:00
OpenStack Proposal Bot
5b9fb69802 Updated from global requirements
Change-Id: I6dc8b32ee5a49fa1c24f04c9431955ea2290a44f
2015-05-04 18:50:41 +00:00