/ unidist / messagequeue.py
messagequeue
Message Queue management
TODO(g): Add auto-deleting options by count or age. Date tag their arrival
in a dict so we can track stuff about it, and can maybe skip it.
TODO(g): Implement serialization, archiving, snapshotting, and replication to
sharestate. This will allow us flexibility in many things. This is not
necessarily going to be the best scaling solution, but it will work and provide
a way to keep state and distribute. Name spaces should have this specified
individually. If not specified, state will not be archived, serialized,
snapshotted or replicated.
Functions
|
|
|
GetMessageCount
|
GetMessageCount ( queue )
Returns the number of messages in a queue.
Args:
queue: string, name space for messages
Returns: int, number of messages in specified queue
|
|
AddMessage
|
AddMessage ( queue, message )
Adds a message to a specified queue.
Args:
queue: string, name space for messages
message: any, data to store in queue
|
|
GetMessage_Oldest
|
GetMessage_Oldest ( queue, remove=True )
Returns the oldest message in the queue(0).
Args:
queue: string, name space for messages
remove: boolean, remove the message from the queue?
|
|
GetAllMessages
|
GetAllMessages ( queue )
Returns all the messages in the queue, for inspection purposes.
Args:
queue: string, name space for messages
|
|
QueueExists
|
QueueExists ( queue )
Does this queue exist?
Args:
queue: string, name space for messages
Returns: boolean, True if queue namespace already exists
|
|
GetMessage_Newest
|
GetMessage_Newest ( queue, remove=True )
Returns the oldest message in the queue(-1).
Args:
queue: string, name space for messages
remove: boolean, remove the message from the queue?
|
|
|