Commit Graph

57 Commits

Author SHA1 Message Date
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
Jenkins c575df2fdb Merge "Enable IPv6-support in libzmq by default" 2014-12-21 03:48:36 +00:00
Frode Nordahl c40ba040a6 Enable IPv6-support in libzmq by default
Change-Id: I53790e5492ebf026e0b331ecb3c294da89603540
Closes-Bug: 1389137
2014-12-19 09:41:46 +01:00
Joshua Harlow 372bc4947e Add a thread + futures executor based executor
The concurrent.futures module is one of the ways
that async activities can be done in the future,
so we should try to work on getting to that future
by using more futures. To enable this (as well as
to enable getting off eventlet), add a thread pool
based executor which will process incoming messages
using the pool.

Also begins adding according docs as well for the
different types of executors that are available.

Change-Id: I1482fd70abbf69f4e2994597c5e95d91fecb815e
2014-12-18 23:49:53 -08:00
James Page cd71c47d32 Add functional and unit 0mq driver tests
Basic functional and unit tests for zmq driver.

Note as the zmq driver is directly dependent on eventlet, this
change also updates the notify logger tests to remove the
direct dependency on threading which was being monkey patched,
causing test failures.

As the zmq driver has a direct dependency on eventlet, tests are
skipped under py3.

Co-Authored-By: Kapil Thangavelu <kapil.thangavelu@canonical.com>
Co-Authored-By: Edward Hope-Morley <edward.hope-morley@canonical.com>

Change-Id: I93b8b2e92d0f2a353d3357a5e61f6d472ec84944
Partial-bug: #1302941
2014-12-09 15:02:31 +00:00
Jenkins 0b839c57b7 Merge "Notification listener pools" 2014-11-27 11:56:42 +00:00
Elena Ezhova 0d49793e34 Create ZeroMQ Context per socket
ZeroMQ Context is a singleton and thus is created only once. This leads
to problems when there is more than one process working with it.
For example, while Neutron server starts, it firstly loads core
plugin and service plugins, which start message handling server,
and only then forks to create api-workers. As a result, all child
processes get the same copy of the context.

Creating new Context for each socket will prevent such situations
from happening and will guarantee that each process works with its
own Context.

Change-Id: I56912e39b119c20f6f23311fc2c7c4b9e9e480d0
Closes-Bug: #1364814
2014-11-18 18:18:07 +03:00
Mehdi Abaakouk 30e0aea877 Notification listener pools
We can now set the pool name of a notification listener
to create multiple groups/pools of listeners consuming notifications
and that each group/pool only receives one copy of each notification.

The AMQP implementation of that is to set queue_name with the pool name.

Implements blueprint notification-listener-pools
Closes-bug: #1356226

Change-Id: I8dc0549f5550f684a261c78c58737b798fcdd656
2014-11-14 10:20:18 +01:00
Jenkins c7211d125c Merge "zmq: Remove dead code" 2014-10-31 19:20:15 +00:00
Mehdi Abaakouk db2709ec83 zmq: Remove dead code
This remove dead code inherit from the old oslo-rpc API

Change-Id: I2792dc47608db0c3210586bd4aecc13e574c034e
2014-10-17 15:06:03 +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
Jenkins 5397da4de3 Merge "Message was send to wrong node with use zmq as rpc_backend" 2014-09-20 01:08:38 +00:00
James Page 4b57eeed13 Construct ZmqListener with correct arguments
The ZmqListener constructor only accepts a driver as an argument.

Drop surplus 'None' in listen_for_notifications method.

Change-Id: I6aec91122bb9406e387728eb2a2380f2c2094595
Closes-Bug: #1368154
2014-09-11 12:13:30 +01:00
zhangjl 3e6c0b38a3 Message was send to wrong node with use zmq as rpc_backend
zmq: Send message to correct endpoint for directed messages

If set the zmq driver needs to use the topic.server
attribute to ensure that messages directed to a
specific endpoint are sent to the correct server rather
than being randomly sent to endpoints advertising the
required topic.

Change-Id: If63235640e0b8e6ec8690a4edaefa1b303705ac6
Closes-bug: #1301723
2014-09-11 17:19:21 +08: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
Brant Knudson 92d56790a6 Set sample_default for rpc_zmq_host
oslo-config-generator will use the sample_default for the sample
config file rather than the hostname of the system it happens to
be running on.

Change-Id: I9c7bf24cfe5c66155d00d9a1b390894d1ccb6bd8
2014-08-13 16:27:51 -05: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
Jenkins 032639e677 Merge "fixed pep8 issue E265" 2014-07-04 15:58:33 +00: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
Jenkins 889bf73021 Merge "Handle unused allowed_remote_exmods in _multi_send" 2014-06-23 09:33:30 +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 a64692689a Merge "Add an optional timeout parameter to Listener.poll" 2014-06-20 18:50:16 +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
Jenkins b60a460baf Merge "zmq: switch back to not using message envelopes" 2014-06-17 00:04:52 +00:00
Elena Ezhova 210ec5003d Handle unused allowed_remote_exmods in _multi_send
allowed_remote_exmods which is passed to _multi_send method in
impl_zmq.py is not passed further to _call, _cast, etc.

Due to that, all remote exceptions, that are supposed to be
expected, are wrapped into messaging.RemoteError exception with
all details of the remote exception.

To fix this allowed_remote_exmods needs to be passed as a
parameter in a called method().

Change-Id: If1dc2f85eab6f542bc21961b9d5c0bd0ab64add2
Closes-Bug: 1330460
2014-06-16 16:23:11 +04: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
Victor Stinner 7fe2ef7334 Add an optional timeout parameter to Listener.poll
For asynchronous programming, a timeout parameter is required on the listener
to allow to stop it at exit. poll() returns None on timeout.

It plan to use it in my new asyncio (Trollius) executor:
https://review.openstack.org/#/c/70983/

See also the related blueprint for the rationale:
https://wiki.openstack.org/wiki/Oslo/blueprints/asyncio

Change-Id: I918ae3c267743a0eaed1d6a210c79fb4a0eb8733
2014-06-13 10:20:39 +02:00
Christian Berendt ab88dfb887 fixed pep8 issue E265
* E265 block comment should start with '# '

E265 was introduced in pep8 1.5 (2014-03-26).

Change-Id: I076addadd2e67a8ac4162c706a36239f4af37a8c
2014-06-08 16:40:08 +00:00
Christian Berendt c0fde47499 remove default=None for config options
In the cfg module default=None is set as the default value.

Change-Id: I5de0c1ddeeaccde8183ec130c85524f5b57f6f74
Closes-Bug: #1323975
2014-05-28 09:08:51 +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
Jamie Lennox 194ed6b973 Fix passing envelope variable as timeout
The envelope variable is being passed positionally in the timeout spot.

Change-Id: I64defdb0a9544d8c2ae69b38f723937b324ae504
2014-05-01 14:13:24 +10:00
Jenkins 06ab616d8f Merge "Logical error in blockless fanout of zmq" 2014-04-22 13:55:24 +00:00
Li Ma de2de36a4a Logical error in blockless fanout of zmq
The blockless fanout doesn't take effect and it
only processes the FIRST one by returning after the first loop.

Change-Id: Iad071ab455e36be7b26637b286ca9f83fea4a019
Closes-Bug: #1300539
2014-04-15 23:23:29 -07:00
Jenkins 8a4f9ad8c9 Merge "Remove old drivers dead code" 2014-04-08 15:36:00 +00:00
Mehdi Abaakouk fd86e0fd54 Remove old drivers dead code
This patch removes some common helper method/class.
Because they are not used anymore by current amqpdriver.

Change-Id: I183750e158e05cf1d0b5e37725676d4882e0c043
2014-04-03 14:35:34 +00:00
Mark McLoughlin 8aa17091b4 zmq: switch back to not using message envelopes
In oslo-incubator, we default to not serializing messages using a
message envelope:

  def _cast(.., envelope=False, ...)

except using the v2 notifyer which explicitly passes envelope=True.

However, in oslo.messaging, we accidentally switched to using a
message envelope:

     def _send(self, ..., envelope=True):

This was not intentional and may be disruptive to users.

This issue was identified because the envelope=True path just doesn't
work! We don't have any zmq tests in oslo.messaging, but even in
oslo-incubator the code path isn't tested and has been broken since
I73aad7697cf83ad4aabb3c2058b7cc4f53f783c2

Partial-Bug: #1301132
Change-Id: I6aa2e2ac3cebf443719d64ebcd9eaadc0a9328b8
2014-04-02 13:06:48 +01:00
zhangjl 2e3b8878c9 Oslo-messaging-zmq-receiver cannot recive any messages
In Icehouse b3 and rc1, when we use impl_zmq as
rpc_backend in nova, nova cannot send any messages
throught impl_zmq to oslo-messaging-zmq-receiver.
The reason is we send two params to serialize_msg
method but it only can recive one.To fix this
problem, I removed the second param which not
used when we call the method serialize_msg.

Change-Id: I2e7546147affd9493f425fd879169932ef206d48
Closes-bug: #1301132
2014-04-02 12:28:14 +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 e9821fe602 Merge "Improve help strings" 2014-02-25 12:40:18 +00:00
Mehdi Abaakouk 9f58e2c3fe Implements notification listener and dispatcher
This patch allows to quickly create a listener to receive
notification messages.

Example of the api:

class Endpoint(object):
    def warn(self, ctxt, publisher_id, event_type, payload):
        do_something(payload)

target = messaging.Target(topic='notifications', exchange='cinder')
listener = notify.get_notification_listener(transport, [target],
                                            [Endpoint()],
                                            executor,
                                            serializer)

Implements blueprint notification-subscriber-server

Change-Id: I434bc487c382a2048670df726d9bebd640150bb9
2014-02-14 16:06:26 +01: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
Mehdi Abaakouk 11a90eabc9 Allow fake driver to consume multiple topics
This patch allow the fake driver to comsume multiple topics
with one listener.

Partial implements blueprint notification-subscriber-server

Change-Id: Ib52dc181e10b487854fbb398eda9f758232a1251
2014-01-30 13:40:42 +01:00
Jenkins 0d6d858805 Merge "Replace data structures' attribute with six module" 2013-12-09 18:24:04 +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 2278ce0b95 Use six.moves.queue instead of Queue
The Queue module has been renamed to queue in Python 3.
Use six.moves.queue to fit the change.

http://docs.python.org/2/library/queue.html#module-Queue

Change-Id: I2940f34d161b2e3cbc5464619f76e6adea4ef9f6
2013-12-07 19:35:41 -08:00