Package coilmq :: Package store :: Class QueueStore
[frames] | no frames]

Class QueueStore

object --+
         |
        QueueStore

Abstract base class for queue storage.

Extensions/implementations of this class must be thread-safe.

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).
 
requeue(self, destination, frame)
Requeue a message (frame) for storing at specified destinationination.
int
size(self, destination)
Size of the queue for specified destination.
int
has_frames(self, destination)
Whether specified destination has any frames.
set
destinations(self)
Provides a set of destinations (queue "addresses") available.
 
close(self)
May be implemented to perform any necessary cleanup operations when store is closed.
 
frames(self, destination)
Returns an iterator for frames in specified queue.

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

Class Variables
  __metaclass__ = abc.ABCMeta
Instance Variables
logging.Logger log
A logger for this class.
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__

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.
Decorators:
  • @abc.abstractmethod
  • @synchronized

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.
Decorators:
  • @abc.abstractmethod
  • @synchronized

requeue(self, destination, frame)

 

Requeue a message (frame) for storing at 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.
Decorators:
  • @synchronized

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

has_frames(self, destination)

 

Whether specified destination has any frames.

Default implementation uses QueueStore.size to determine if there are any frames in queue. Subclasses may choose to optimize this.

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

destinations(self)

 

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

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

close(self)

 

May be implemented to perform any necessary cleanup operations when store is closed.

Decorators:
  • @synchronized

frames(self, destination)

 

Returns an iterator for frames in specified queue.

The iterator simply wraps calls to dequeue method, so the order of the frames from the iterator will be the reverse of the order in which the frames were enqueued.

Parameters:
  • destination (str) - The queue destination (e.g. /queue/foo)