C# 클래스 Westwind.MessageQueueing.QueueMessageManager

An implementation of a SQL 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. Great for long running tasks or even light workflow scenarios.
상속: IDisposable
파일 보기 프로젝트 열기: RickStrahl/Westwind.QueueMessageManager 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
_IsNew bool

공개 메소드들

메소드 설명
CancelRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool

Sets the Item record with the required settings to complete and cancel a request. Not saved to database call Save() explicitly.

ClearMessages ( System.TimeSpan messageTimeout = null ) : bool

Method used to clear out 'old' messages to keep database size down Removes messages that have been started but not completed in the specified timeout period.

CompleteRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool

Sets the Item record with the required settings to complete a request. Note record is not written to database - Call Save explicitly.

CreateDatastore ( ) : bool

Creates the DatabaseTable and stored procedure for the queue. Note this routine requires that a database exists already and uses the same connection string that is used for the main application.

CreateItem ( QueueMessageItem entity = null ) : QueueMessageItem

Creates a new item instance and properly initializes the instance's values.

DeleteMessage ( string id ) : bool
DeleteWaitingMessages ( string queueName = null ) : bool
Dispose ( ) : void

Clear data access component

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

Returns all messages in a queue that are cancelled

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

Result Cursor: TCompleteMessages

GetNextQueueMessage ( string queueName = null ) : QueueMessageItem

Retrieves the next pending 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.

GetProperty ( string key ) : object

Retrieves a value from the Properties collection safely. If the value doesn't exist null is returned.

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

Returns a list of recent queue items

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

Returns a list of queue items that have timed out during processing. Not completed where started time is greater than the MessageTimeout.

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 completion.

Load ( string id ) : QueueMessageItem

Loads a Queue Item

QueueMessageManager ( ) : System
QueueMessageManager ( string connectionString ) : System
ResubmitMessage ( QueueMessageItem item = null ) : bool

Resubmits an existing message by clearing out all completion/date settings and then resubmitting the entry. This method calls Save() and actually saves the message to disk.

Save ( QueueMessageItem item = null ) : bool

Saves the passed item or the attached item to the database. Call this after updating properties or individual values.

SetError ( ) : void

Clear the error messages

SetError ( Exception ex, bool checkInner = false ) : void

Set from exception and optionally use inner exception

SetError ( string message ) : void

Set error to the error message

SubmitRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool

Sets the message properties for starting a new message request operation. Note the record is not written to the database use Save explicitly

UpdateQueueMessageStatus ( QueueMessageItem item = null, string status = null, string messageText = null, int percentComplete = -1, bool autoSave = false ) : bool

Updates the QueueMessageStatus and or messages

보호된 메소드들

메소드 설명
GetProperties ( string stringFieldNameToLoadFrom = "Properties", object entity = null ) : void

Loads the Properties dictionary with values from a Properties property of an item object. Once loaded you can access the dictionary to read and write values from it arbitrarily and use SetProperties to write the values back in serialized form to the underlying property for database storage.

SetProperties ( string stringFieldToSaveTo = "Properties", object entity = null ) : void

Saves the Properties Dictionary - in serialized string form - to a specified item field which in turn allows writing the data back to the database.

메소드 상세

CancelRequest() 공개 메소드

Sets the Item record with the required settings to complete and cancel a request. Not saved to database call Save() explicitly.
public CancelRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool
item QueueMessageItem
messageText string
autoSave bool
리턴 bool

ClearMessages() 공개 추상적인 메소드

Method used to clear out 'old' messages to keep database size down Removes messages that have been started but not completed in the specified timeout period.
public abstract ClearMessages ( System.TimeSpan messageTimeout = null ) : bool
messageTimeout System.TimeSpan
리턴 bool

CompleteRequest() 공개 메소드

Sets the Item record with the required settings to complete a request. Note record is not written to database - Call Save explicitly.
public CompleteRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool
item QueueMessageItem
messageText string
autoSave bool
리턴 bool

CreateDatastore() 공개 추상적인 메소드

Creates the DatabaseTable and stored procedure for the queue. Note this routine requires that a database exists already and uses the same connection string that is used for the main application.
public abstract CreateDatastore ( ) : bool
리턴 bool

CreateItem() 공개 메소드

Creates a new item instance and properly initializes the instance's values.
public CreateItem ( QueueMessageItem entity = null ) : QueueMessageItem
entity QueueMessageItem
리턴 QueueMessageItem

DeleteMessage() 공개 추상적인 메소드

public abstract DeleteMessage ( string id ) : bool
id string
리턴 bool

DeleteWaitingMessages() 공개 추상적인 메소드

public abstract DeleteWaitingMessages ( string queueName = null ) : bool
queueName string
리턴 bool

Dispose() 공개 메소드

Clear data access component
public Dispose ( ) : void
리턴 void

GetCancelledMessages() 공개 추상적인 메소드

Returns all messages in a queue that are cancelled
public abstract GetCancelledMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
리턴 IEnumerable

GetCompleteQueueMessages() 공개 추상적인 메소드

Result Cursor: TCompleteMessages
public abstract GetCompleteQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
리턴 IEnumerable

GetNextQueueMessage() 공개 추상적인 메소드

Retrieves the next pending Message from the Queue based on a provided queueName
public abstract GetNextQueueMessage ( string queueName = null ) : QueueMessageItem
queueName string
리턴 QueueMessageItem

GetPendingQueueMessages() 공개 추상적인 메소드

Retrieves all messages that are pending, that have started but not completed yet.
public abstract 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
리턴 IEnumerable

GetProperties() 보호된 메소드

Loads the Properties dictionary with values from a Properties property of an item object. Once loaded you can access the dictionary to read and write values from it arbitrarily and use SetProperties to write the values back in serialized form to the underlying property for database storage.
protected GetProperties ( string stringFieldNameToLoadFrom = "Properties", object entity = null ) : void
stringFieldNameToLoadFrom string The name of the field to load the XML properties from.
entity object
리턴 void

GetProperty() 공개 메소드

Retrieves a value from the Properties collection safely. If the value doesn't exist null is returned.
public GetProperty ( string key ) : object
key string
리턴 object

GetRecentQueueItems() 공개 추상적인 메소드

Returns a list of recent queue items
public abstract GetRecentQueueItems ( string queueName = null, int itemCount = 25 ) : IEnumerable
queueName string
itemCount int
리턴 IEnumerable

GetTimedOutQueueMessages() 공개 추상적인 메소드

Returns a list of queue items that have timed out during processing. Not completed where started time is greater than the MessageTimeout.
public abstract GetTimedOutQueueMessages ( string queueName = null, int maxCount ) : IEnumerable
queueName string
maxCount int
리턴 IEnumerable

GetWaitingQueueMessageCount() 공개 추상적인 메소드

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

GetWaitingQueueMessages() 공개 추상적인 메소드

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

IsCompleted() 공개 추상적인 메소드

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 completion.
public abstract IsCompleted ( string id = null ) : bool
id string
리턴 bool

Load() 공개 추상적인 메소드

Loads a Queue Item
public abstract Load ( string id ) : QueueMessageItem
id string
리턴 QueueMessageItem

QueueMessageManager() 공개 메소드

public QueueMessageManager ( ) : System
리턴 System

QueueMessageManager() 공개 메소드

public QueueMessageManager ( string connectionString ) : System
connectionString string
리턴 System

ResubmitMessage() 공개 메소드

Resubmits an existing message by clearing out all completion/date settings and then resubmitting the entry. This method calls Save() and actually saves the message to disk.
public ResubmitMessage ( QueueMessageItem item = null ) : bool
item QueueMessageItem
리턴 bool

Save() 공개 추상적인 메소드

Saves the passed item or the attached item to the database. Call this after updating properties or individual values.
public abstract Save ( QueueMessageItem item = null ) : bool
item QueueMessageItem
리턴 bool

SetError() 공개 메소드

Clear the error messages
public SetError ( ) : void
리턴 void

SetError() 공개 메소드

Set from exception and optionally use inner exception
public SetError ( Exception ex, bool checkInner = false ) : void
ex System.Exception
checkInner bool
리턴 void

SetError() 공개 메소드

Set error to the error message
public SetError ( string message ) : void
message string
리턴 void

SetProperties() 보호된 메소드

Saves the Properties Dictionary - in serialized string form - to a specified item field which in turn allows writing the data back to the database.
protected SetProperties ( string stringFieldToSaveTo = "Properties", object entity = null ) : void
stringFieldToSaveTo string
entity object
리턴 void

SubmitRequest() 공개 메소드

Sets the message properties for starting a new message request operation. Note the record is not written to the database use Save explicitly
public SubmitRequest ( QueueMessageItem item = null, string messageText = null, bool autoSave = false ) : bool
item QueueMessageItem An existing item instance
messageText string
autoSave bool
리턴 bool

UpdateQueueMessageStatus() 공개 메소드

Updates the QueueMessageStatus and or messages
public UpdateQueueMessageStatus ( QueueMessageItem item = null, string status = null, string messageText = null, int percentComplete = -1, bool autoSave = false ) : bool
item QueueMessageItem
status string
messageText string
percentComplete int
autoSave bool
리턴 bool

프로퍼티 상세

_IsNew 보호되어 있는 프로퍼티

protected bool _IsNew
리턴 bool