Package coilmq :: Package store :: Package sa :: Class SAQueue
[frames] | no frames]

Class SAQueue

object --+    
         |    
QueueStore --+
             |
            SAQueue

A QueueStore implementation that stores messages in a database and uses SQLAlchemy to interface with the database.

Note that this implementation does not actually use the ORM capabilities of SQLAlchemy, but simply uses SQLAlchemy for the DB abstraction for SQL building and DDL (table creation).

This coilmq.store.sa.model.setup_tables function is used to actually define (& create) the database tables. This class also depends on the init_model method have been called to define the coilmq.store.sa.model.Session class-like callable (and the engine & metadata).

Finally, this class does not explicitly use shared data (db connections); a new Session is created in each method. The actual implementation is handled using SQLAlchemy scoped sessions, which provide thread-local Session class-like callables. As a result of deferring that to the SA layer, we don't need to use synchronization locks to guard calls to the methods in this store implementation.

Instance Methods
 
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).
bool
has_frames(self, destination)
Whether specified queue has any frames.
int
size(self, destination)
Size of the queue for specified destination.
set
destinations(self)
Provides a list of destinations (queue "addresses") available.
 
close(self)
Closes the databases, freeing any resources (and flushing any unsaved changes to disk).

Inherited from QueueStore: __init__, 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

enqueue(self, destination, frame)

 

Store message (frame) for specified destinationination.

Parameters:
  • destination (str) - The destinationination queue name for this message (frame).
  • frame (stompclient.frame.Frame) - The message (frame) to send to specified destinationination.
Overrides: QueueStore.enqueue

dequeue(self, destination)

 

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

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

has_frames(self, destination)

 

Whether specified queue has any frames.

Parameters:
  • destination (str) - The queue name (destinationination).
Returns: bool
Whether there are any frames in the specified queue.
Overrides: QueueStore.has_frames

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.
Overrides: QueueStore.size

destinations(self)

 

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

Returns: set
A list of the detinations available.
Overrides: QueueStore.destinations

close(self)

 

Closes the databases, freeing any resources (and flushing any unsaved changes to disk).

Overrides: QueueStore.close