46 Commits

Author SHA1 Message Date
Mark McLoughlin
4043506a23 Add missing gettextutils
We don't need this in oslo.messaging itself, but excutils and sslutils
do use it.

Change-Id: Ib35caa6616aab7be1a7f872b2073f7b9f606b258
2013-07-27 15:49:48 +01:00
Mark McLoughlin
45ab8699a6 Connection pool bugfix
This is only seen if you try to call amqp.cleanup().

Change-Id: I5c14a21987b4b7aeca7dddc91d7c8b2510edefeb
2013-07-26 07:41:09 +01:00
Mark McLoughlin
b7350fa229 Add initial rabbit driver
There's obviously an awful lot of work left to do on this. Some 20
FIXMEs, for a start :)

However, the test client can successfully invoke a call() and get a
reply back from the server!

The main complexity is in how the client waits for a reply, especially
where there are multiple threads all waiting for replies. Rather than
follow the current method of spawning off a greenthread (and the implied
dependency on eventlet) to read the replies and pass them to the queue
for the appropriate waiting thread, we instead have one of the waiting
threads take on that responsibility.

Change-Id: I20d3d66a5cc9820752e7eaebd8871ffb235d31c9
2013-07-24 08:15:35 +01:00
Mark McLoughlin
c719dc306b Don't call consume() each time iterconsume() is called
We're going to be using iterconsume(limit=1) and this basically seems
to be broken right now because you get an error if you call consume()
multiple times on the same connection.

Set the 'do_consume' flag at connection time rather than on entry into
iterconsume().

Change-Id: I988e4074ae0e267384931d6e1994e9cbe5248196
2013-07-24 08:15:35 +01:00
Mark McLoughlin
8ccb5741d2 Remove use of gettextutils
We don't have any infrastructure for localizations in oslo.messaging
so using this is pointless right now. I'm also generally not convinced
we want to translate any of the strings in this library anyway.

For now, just add a dummy _() function. We can can unmark the strings
later.

Change-Id: I1b6a698ee5558c50dc5eafee1f5f05ee2570435e
2013-07-24 08:15:35 +01:00
Mark McLoughlin
c891e7ee24 Remove use of openstack.common.local
This means we no longer set the request context for the current thread
so that it can be used in logging.

We do need to add this back later, but it might be in the form of a
get_current_context() method.

Change-Id: I3f08a85e2019affddec829e2ea008b5c10707660
2013-07-24 08:15:35 +01:00
Mark McLoughlin
1a7e51eb4a Use stdlib logging
I guess this loses us automatic logging of details from request context.

Change-Id: I7413f025231c14b7cbdc9e90099407bc6c7943e1
2013-07-24 08:15:35 +01:00
Mark McLoughlin
e3c5b99959 Port away from some eventlet infrastructure
Add a simple object pool implementation for our connection pool, in
place of eventlet.pools.Pool.

Also use threading.Lock in place of eventlet.Semaphore.

There are still some eventlet modules imported by the code, but we can
avoid using them at runtime and clean things up later. We can't remove
them now or it'll cause pep8 failures.

Change-Id: I380408d1321802de813de541cd0a2d4305c3627c
2013-07-24 08:15:34 +01:00
Mark McLoughlin
37bd6923dc Don't register options with cfg.CONF at module import
oslo.messaging will only register options with a ConfigOpts object
supplied by the caller.

Change-Id: I18115e9dd5241b1bdfae14671a62328c47125400
2013-07-24 08:15:34 +01:00
Mark McLoughlin
04dd4e1773 Adjust imports in rabbit/qpid drivers
Some modules are in oslo.messaging.openstack.common and others are in
oslo.messaging._drivers.

Change-Id: I3581eff3427858c8f46673e4a3c376367c626bb3
2013-07-24 08:15:34 +01:00
Mark McLoughlin
51be674f30 Import some needed modules from oslo-incubator
Some additional modules from oslo-incubator are required by the driver
code. Don't fret, some of these will be removed in subsequent patches!

Change-Id: I3674bfbc4b1c93afc746b84fbbf8859456cbcb3c
2013-07-23 18:34:42 +01:00
Mark McLoughlin
e91dbef454 Add oslo-incubator code unmodified
I want to make it absolutely clear what changes we're making from the
original driver code, so let's start with a pristine copy.

Change-Id: I38507382b1ce68c7f8f697522f9a1bf00e76532d
2013-07-23 18:34:42 +01:00
Mark McLoughlin
43ab36d1a1 Make executor threads more robust
See bug #1189711

Prevent the executor thread getting killed by exceptions.

Change-Id: I0787fa619a6a8a35a303627f8ce119c93f2c8765
2013-07-23 18:34:42 +01:00
Mark McLoughlin
837aa03c43 Include docstrings in published docs
Change-Id: Icdfb0535b26162d39c3af683b7729b5e834d89b9
2013-07-10 09:33:13 +01:00
Mark McLoughlin
fc99d966af Make test notifier useful
We need a way to query what notifications were sent to the test notifier
and later clear out that list.
2013-06-24 12:52:56 +01:00
Mark McLoughlin
75c376aab0 Use lowercase priority in log notifier 2013-06-24 12:52:56 +01:00
Mark McLoughlin
54d875bcac Use lowercase priority in notifications topic 2013-06-24 12:52:56 +01:00
Mark McLoughlin
4000eec07c Handle case where no drivers configured 2013-06-24 12:52:56 +01:00
Mark McLoughlin
89e7301e4e Fix buglet in v2 messaging notifier 2013-06-24 12:52:56 +01:00
Mark McLoughlin
ec9b36dec2 Make LOG private in notifier 2013-06-24 12:52:56 +01:00
Mark McLoughlin
351eb2d9e4 Require a transport to construct a Notifier
Rather than construct it from cfg.CONF by default, just require that one
is supplied.
2013-06-24 12:52:56 +01:00
Mark McLoughlin
cfeaf2a292 Add serializer support to notifier
The notifier in oslo-incubator does:

  payload = jsonutils.to_primitive(payload, convert_instances=True)

Using the serializer abstraction should be a more general was of
supporting this.
2013-06-24 12:52:56 +01:00
Mark McLoughlin
f17f00ba88 Rename context to ctxt in serializer API 2013-06-24 12:52:56 +01:00
Mark McLoughlin
fcfe15af04 Rename context to ctxt in notify API
ctxt is the name we've used in the rest of oslo.messaging, so ...
2013-06-24 12:52:56 +01:00
Mark McLoughlin
eb94be8834 Make Notifier public at top-level 2013-06-24 12:52:56 +01:00
Mark McLoughlin
b5e43afc37 Docstrings for notifier API 2013-06-24 12:52:41 +01:00
Mark McLoughlin
03aafcb49c Simplify public symbol exports
Inspired by tulip, have every module define a __all__ list and import *
from the top-level module.

Rename transport.set_defaults() since we don't want this to be a
top-level set_defaults() function as there may be multiple.

Also, rather than configuring flake8 to allow star imports, just exclude
the __init__.py files from flake8 checks.
2013-06-24 12:52:30 +01:00
Mark McLoughlin
5cd662a517 Make exchange_from_url() use parse_url() 2013-06-16 16:08:48 +01:00
Mark McLoughlin
1a8adfbceb Fix parse_urls() buglets
When you expect split() to return 2 values, make sure to tell it to only
do a single split.
2013-06-16 15:58:02 +01:00
Mark McLoughlin
29cb5b0b58 Move url utils into messaging._urls 2013-06-16 15:27:36 +01:00
Mark McLoughlin
e67f409b87 Don't use common logging
It appears we don't actually need this - we don't, for example, use any
of the special formatting supported by ContextAdaptor.
2013-06-16 15:24:41 +01:00
Mark McLoughlin
9cb803ee10 Fix fake driver with eventlet
By storing the reply_q on the listener, we were assuming there was only
one message being dispatched at the time. Put it on the incoming message
instead and use it directly in reply().
2013-06-16 12:23:11 +01:00
Mark McLoughlin
fd68391d53 Use log.warning() instead of log.warn()
warn() is provided by ContextAdapter, there's no reason to use it.
2013-06-16 12:00:09 +01:00
Mark McLoughlin
d821999629 Don't translate exception messages 2013-06-16 11:55:47 +01:00
Mark McLoughlin
293a34c156 Add can_send_version() to RPCClient
Add a helper method to the RPCClient class.  This is a little nicer to
use for checking to see if a given message is copmatible with the set
version cap.

This can be used in a bunch of different ways:

  client = RPCClient(version_cap='1.6', version='1.0')
  client.can_send_version()
  client.can_send_version(version='1.6')

  client = client.prepare(version_cap='1.8', version='1.5')
  client.can_send_version()
  client.can_send_version(version='1.2')

Co-authored-by: Russell Bryant <rbryant@redhat.com>
2013-06-16 09:39:09 +01:00
Mark McLoughlin
24af12f053 Remove unused statements in base serializer 2013-06-15 21:27:11 +01:00
Mark McLoughlin
cf44b8d01d Fix thinko in exchange_from_url()
Funnily enough, this was just shown by the coverage report.
2013-06-15 21:25:34 +01:00
Mark McLoughlin
0fc785267f Add docstrings for base executor class
Avoiding spurious missed lines in coverage report.
2013-06-15 21:20:26 +01:00
Mark McLoughlin
de88d62998 Remove a fixed fixme 2013-06-15 21:19:05 +01:00
Mark McLoughlin
1ab3b83f43 Don't raise a driver-specific error on send
Similar to doing listen() on the server side, if the driver throws an
exception when we do a cast() or call() we should translate it into
a transport-agnostic exception.
2013-06-15 19:24:32 +01:00
Mark McLoughlin
2be7df70b0 Add some docstrings to driver base
Eliminates spurious missed lines from coverage report.
2013-06-15 19:13:45 +01:00
Mark McLoughlin
8a8685b62f Make it possible to call prepare() on call context
Found it's quite easy to get into doing e.g.

  client = RPCClient(...)
  client = client.prepare(topic='foo')
  client = client.prepare(server='bar')
2013-06-15 18:56:15 +01:00
Mark McLoughlin
978d19c256 Rework how queues get created in fake driver
Currently, if there are no servers listening on a topic then a message
to that topic just gets dropped by the fake driver.

This makes the tests intermittently fail if the server takes longer to
start.

Turn things on their head so that the client always creates the queues
on the exchange so that messages can get queued up even if there is no
server listening.

Now we also need to delete the "duplicate server on topic" test - it's
actually fine to have multiple servers listening on the one topic.
2013-06-15 18:56:11 +01:00
Mark McLoughlin
cbfb1452a4 Move files to new locations for oslo.messaging 2013-06-15 08:43:54 +01:00
Mark McLoughlin
be649d1d74 Import stuff from oslo-incubator 2013-06-15 08:43:54 +01:00
Mark McLoughlin
b5c41bba00 Add oslo.messaging project infrastructure 2013-06-15 08:43:50 +01:00