# class MessageQueue | A message queue. More...
Full name | `TelEngine::MessageQueue`
Definition | `#include <yatengine.h>`
Inherits | TelEngine::MessageHook [public ], TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- MessageQueue (const char* hookName, int numWorkers = 0)
- ~MessageQueue ()
- virtual bool enqueue (Message* msg)
- bool dequeue ()
- void addFilter (const char* name, const char* value)
- void removeFilter (const String& name)
- virtual void clear ()
- void removeThread (Thread* thread)
- inline unsigned int count () const
- inline const NamedList& getFilters () const
- virtual bool matchesFilter (const Message& msg)

#### Protected Methods

- virtual void received (Message& msg)

## Detailed Description

MessageQueue class allows to create a private queue for a message who matches the specified filters.

MessageQueue (const char* hookName, int numWorkers = 0) | ### MessageQueue

Creates a new message queue.

Parameters:

hookName | Name of the message served by this queue
numWorkers | The number of workers who serve this queue

~MessageQueue () | ### ~MessageQueue

Destroys the message queue

bool enqueue (Message* msg) | ### enqueue

[virtual]

Append a message in the queue

Parameters:

msg | The message to enqueue, will be destroyed after the processing is done

Returns: True if successfully queued, false otherwise

Reimplemented from MessageHook.

bool dequeue () | ### dequeue

Process a message from the waiting queue

Returns: False if the message queue is empty

void addFilter (const char* name, const char* value) | ### addFilter

Add a new filter to this queue

Parameters:

name | The filter name
value | The filter value

void removeFilter (const String& name) | ### removeFilter

Remove a filter form this queue

Parameters:

name | The filter name

void clear () | ### clear

[virtual]

Clear private data

Reimplemented from MessageHook.

void removeThread (Thread* thread) | ### removeThread

Remove a thread from workers list

Parameters:

thread | The thread to remove

inline unsigned int count () | ### count

[const]

Helper method to obtain the number of unprocessed messages in the queue

Returns: The number of queued messages.

Reimplemented from Mutex.

inline const NamedList& getFilters () | ### getFilters

[const]

Obtain the filter list for this queue

Returns: The filter list

bool matchesFilter (const Message& msg) | ### matchesFilter

[virtual]

Check if the given message can be inserted in this queue

Parameters:

msg | The message to check

Returns: True if the message can be inserted in this queue

Reimplemented from MessageHook.

void received (Message& msg) | ### received

[protected virtual]

Callback method for message processing Default calls Engine::dispatch

Parameters:

msg | The message to process

Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.