Package coilmq :: Package store :: Module memory :: Class MemoryQueue
[frames] | no frames]

Class MemoryQueue

object --+    
         |    
QueueStore --+
             |
            MemoryQueue

A QueueStore implementation that stores messages in memory.

This classes uses a threading.RLock to guard access to the memory store. The locks on this class are probably excessive given that the coilmq.queue.QueueManager is already implementing coarse-grained locking on the methods that access this storage backend. That said, we'll start over-protective and refactor later it if proves unecessary.

Instance Methods
 
__init__(self)
A base constructor that sets up logging and the lock used by synchronized decorator.
 
enqueue(self, destination, frame)
Store message (frame) for specified destinationination.
stompclient.frame.Frame
dequeue(self, destination)
Removes and returns an item from the queue (or None if no items in queue).
int
size(self, destination)
Size of the queue for specified destination.
int
has_frames(self, destination)
Whether this queue has frames for the specified destination.
set
destinations(self)
Provides a list of destinations (queue "addresses") available.

Inherited from QueueStore: close, frames, requeue

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables

Inherited from QueueStore: __metaclass__

Instance Variables

Inherited from QueueStore: log

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 

A base constructor that sets up logging and the lock used by synchronized decorator.

If you extend this class, you should either call this method or at minimum make sure these values get set.

Overrides: object.__init__
(inherited documentation)

enqueue(self, destination, frame)

 

Store message (frame) for specified destinationination.

Parameters:
  • destination - The destinationination queue name for this message (frame).
  • frame - The message (frame) to send to specified destinationination.
Decorators:
  • @synchronized
Overrides: QueueStore.enqueue
(inherited documentation)

dequeue(self, destination)

 

Removes and returns an item from the queue (or None if no items in queue).

Parameters:
  • destination - The queue name (destinationination).
Returns: stompclient.frame.Frame
The first frame in the specified queue, or None if there are none.
Decorators:
  • @synchronized
Overrides: QueueStore.dequeue
(inherited documentation)

size(self, destination)

 

Size of the queue for specified destination.

Parameters:
  • destination (str) - The queue destination (e.g. /queue/foo)
Returns: int
The number of frames in specified queue.
Decorators:
  • @synchronized
Overrides: QueueStore.size

has_frames(self, destination)

 

Whether this queue has frames for the specified destination.

Parameters:
  • destination - The queue destination (e.g. /queue/foo)
Returns: int
The number of frames in specified queue.
Decorators:
  • @synchronized
Overrides: QueueStore.has_frames

destinations(self)

 

Provides a list of destinations (queue "addresses") available.

Returns: set
A list of the detinations available.
Decorators:
  • @synchronized
Overrides: QueueStore.destinations