C# Class Westwind.MessageQueueing.QueueMessageManagerMongoDb

An implementation of a MongoDb based multi-access Queue that provides random acccess to requests so they can be retrived for long running tasks where both client and server can interact with each message for processing. This implementation uses purely MongoDb server data access to handle the queue which works well for low to high volume loads. Great for long running tasks or even light workflow scenarios.
Inheritance: QueueMessageManager
Afficher le fichier Open project: RickStrahl/Westwind.QueueMessageManager

Méthodes publiques

Méthode Description
ClearMessages ( System.TimeSpan messageTimeout = null ) : bool
CreateDatastore ( ) : bool
DeleteMessage ( string id ) : bool

Deletes an individual queue message by Id

DeleteWaitingMessages ( string queueName = null ) : bool

Deletes all messages that are waiting to be processed

Dispose ( ) : void

Clear data access component

GetCancelledMessages ( string queueName = null, int maxCount ) : IEnumerable
GetCompleteQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
GetNextQueueMessage ( string queueName = null ) : QueueMessageItem

Retrieves the next waiting Message from the Queue based on a provided queueName

GetPendingQueueMessages ( string queueName = null, int maxCount ) : IEnumerable

Retrieves all messages that are pending, that have started but not completed yet.

GetRecentQueueItems ( string queueName = null, int itemCount = 25 ) : IEnumerable

Returns a list of recent queue items

GetTimedOutQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
GetWaitingQueueMessageCount ( string queueName = null ) : int

Returns a count of messages that are waiting to be processed - this is the queue backup.

GetWaitingQueueMessages ( string queueName = null, int maxCount ) : IEnumerable

Returns a count of messages that are waiting to be processed - this is the queue backup.

IsCompleted ( string id = null ) : bool

Determines if anqueue has been completed successfully or failed. Note this method returns true if the request has completed or cancelled/failed. It just checks for completion.

Load ( string id ) : QueueMessageItem

Loads a Queue Message Item by its ID

QueueMessageManagerMongoDb ( ) : System
QueueMessageManagerMongoDb ( string connectionString ) : System
Save ( QueueMessageItem item = null ) : bool

Saves the passed message item or the attached item to the database. Call this after updating properties or individual values. Inserts or updates based on whether the ID exists

Méthodes protégées

Méthode Description
GetDatabase ( string connectionString = null, string databaseName = null ) : MongoDatabase

Creates a connection to a databaseName based on the Databasename and optional server connection string. Returned Mongo DatabaseName 'connection' can be cached and reused.

Method Details

ClearMessages() public méthode

public ClearMessages ( System.TimeSpan messageTimeout = null ) : bool
messageTimeout System.TimeSpan
Résultat bool

CreateDatastore() public méthode

public CreateDatastore ( ) : bool
Résultat bool

DeleteMessage() public méthode

Deletes an individual queue message by Id
public DeleteMessage ( string id ) : bool
id string
Résultat bool

DeleteWaitingMessages() public méthode

Deletes all messages that are waiting to be processed
public DeleteWaitingMessages ( string queueName = null ) : bool
queueName string
Résultat bool

Dispose() public méthode

Clear data access component
public Dispose ( ) : void
Résultat void

GetCancelledMessages() public méthode

public GetCancelledMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
Résultat IEnumerable

GetCompleteQueueMessages() public méthode

public GetCompleteQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
Résultat IEnumerable

GetDatabase() protected méthode

Creates a connection to a databaseName based on the Databasename and optional server connection string. Returned Mongo DatabaseName 'connection' can be cached and reused.
protected GetDatabase ( string connectionString = null, string databaseName = null ) : MongoDatabase
connectionString string Mongo server connection string. /// Can either be a connection string entry name from the ConnectionStrings /// section in the config file or a full server string. /// If not specified looks for connectionstring entry in same name as /// the context. Failing that mongodb://localhost is used. /// /// Examples: /// MyDatabaseConnectionString (ConnectionStrings Config Name) /// mongodb://localhost /// mongodb://localhost:22011/MyDatabase /// mongodb://username:password@localhost:22011/MyDatabase ///
databaseName string Name of the databaseName to work with if not specified on the connection string
Résultat MongoDatabase

GetNextQueueMessage() public méthode

Retrieves the next waiting Message from the Queue based on a provided queueName
public GetNextQueueMessage ( string queueName = null ) : QueueMessageItem
queueName string Name of the queue
Résultat QueueMessageItem

GetPendingQueueMessages() public méthode

Retrieves all messages that are pending, that have started but not completed yet.
public GetPendingQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string Name of the queue to return items for
maxCount int Optional - max number of items to return
Résultat IEnumerable

GetRecentQueueItems() public méthode

Returns a list of recent queue items
public GetRecentQueueItems ( string queueName = null, int itemCount = 25 ) : IEnumerable
queueName string
itemCount int Max number of items to return
Résultat IEnumerable

GetTimedOutQueueMessages() public méthode

public GetTimedOutQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
Résultat IEnumerable

GetWaitingQueueMessageCount() public méthode

Returns a count of messages that are waiting to be processed - this is the queue backup.
public GetWaitingQueueMessageCount ( string queueName = null ) : int
queueName string
Résultat int

GetWaitingQueueMessages() public méthode

Returns a count of messages that are waiting to be processed - this is the queue backup.
public GetWaitingQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
Résultat IEnumerable

IsCompleted() public méthode

Determines if anqueue has been completed successfully or failed. Note this method returns true if the request has completed or cancelled/failed. It just checks for completion.
public IsCompleted ( string id = null ) : bool
id string
Résultat bool

Load() public méthode

Loads a Queue Message Item by its ID
public Load ( string id ) : QueueMessageItem
id string
Résultat QueueMessageItem

QueueMessageManagerMongoDb() public méthode

public QueueMessageManagerMongoDb ( ) : System
Résultat System

QueueMessageManagerMongoDb() public méthode

public QueueMessageManagerMongoDb ( string connectionString ) : System
connectionString string
Résultat System

Save() public méthode

Saves the passed message item or the attached item to the database. Call this after updating properties or individual values. Inserts or updates based on whether the ID exists
public Save ( QueueMessageItem item = null ) : bool
item QueueMessageItem
Résultat bool