C# 클래스 Westwind.MessageQueueing.QueueController

This class is a Server Controller that can be run by a Host process to handle processing of message requests in Windows Forms/Service applications. It provides a multi-threaded server process that fires events when messages arrive in the queue and are completed. A client application can simply drop this component into the app and attach to the events provdided here.
상속: IDisposable
파일 보기 프로젝트 열기: RickStrahl/Westwind.QueueMessageManager 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void
Initialize ( QueueMessageManagerConfiguration configuration = null, Type queueManagerType = null ) : void

Initializes the QueueController from the Queue Configuration Settings

PauseProcessing ( bool pause = true ) : void

Pauses processing by keeping the thread alive and waiting until the pause is unset

QueueController ( ) : System
StartProcessing ( ) : void

Synchronous Message Processing routine - will process one message after another

StartProcessingAsync ( int threads = -1 ) : void

Starts queue processing asynchronously on the specified number of threads. This is a common scenario for Windows Forms interfaces so the UI stays active while the application monitors and processes the queue on a separate non-ui thread

StopProcessing ( ) : void

Shuts down the Message Processing loop

보호된 메소드들

메소드 설명
ExecuteSteps ( QueueMessageManager manager ) : void

This is the 'handler' code that actually does processing work It merely calls into any events that are hooked up to the controller for these events: ExecuteStart ExecuteComplete ExecuteFailed

OnExecuteComplete ( QueueMessageManager Message ) : void

Override this method to do any post processing that needs to happen after each async operation has successfully completed. Optional - use for things like logging or reporting on status.

OnExecuteFailed ( QueueMessageManager manager, Exception ex ) : void

Override this method to handle any errors that occured during processing of the async task. Optional - implement for logging or notifications.

OnExecuteStart ( QueueMessageManager manager ) : void

Override this method to process your async operation. Required for anything to happen when the message is processed. If the operation succeeds (no exception), OnExecuteComplete will be called. This method should throw an exception if the operation fails, so that OnExecuteFailed will be fired.

OnGetNextQueueMessage ( QueueMessageManager manager, string queueName ) : QueueMessageItem

Message hook that's responsible for retrieving the next message. The base version pulls the next message for the given queue. You can override this method to conditionally override this behavior such as filter when and how messages are read.

OnNextMessageFailed ( QueueMessageManager manager, Exception ex ) : void

Override this method to handle any errors that occured trying to receive the next message from the SQL table. Allows for error handling or logging in your own applications.

OnStartProcessing ( ) : bool

Method that is called just before the the controller starts up processing for the queue. If you return false from this method the controller queue is not started.

OnStopProcessing ( ) : bool

Method that is called just before the controller stops processing requests. Use to send messages. If you return false from this method the queue is not stoped.

메소드 상세

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

ExecuteSteps() 보호된 메소드

This is the 'handler' code that actually does processing work It merely calls into any events that are hooked up to the controller for these events: ExecuteStart ExecuteComplete ExecuteFailed
protected ExecuteSteps ( QueueMessageManager manager ) : void
manager QueueMessageManager Instance of QueueMessageManager and it's Item property
리턴 void

Initialize() 공개 메소드

Initializes the QueueController from the Queue Configuration Settings
public Initialize ( QueueMessageManagerConfiguration configuration = null, Type queueManagerType = null ) : void
configuration QueueMessageManagerConfiguration
queueManagerType System.Type
리턴 void

OnExecuteComplete() 보호된 메소드

Override this method to do any post processing that needs to happen after each async operation has successfully completed. Optional - use for things like logging or reporting on status.
protected OnExecuteComplete ( QueueMessageManager Message ) : void
Message QueueMessageManager
리턴 void

OnExecuteFailed() 보호된 메소드

Override this method to handle any errors that occured during processing of the async task. Optional - implement for logging or notifications.
protected OnExecuteFailed ( QueueMessageManager manager, Exception ex ) : void
manager QueueMessageManager /// QueueManager instance. Use its Item property to get access to the current method ///
ex System.Exception /// Exeception that caused the operation to fail ///
리턴 void

OnExecuteStart() 보호된 메소드

Override this method to process your async operation. Required for anything to happen when the message is processed. If the operation succeeds (no exception), OnExecuteComplete will be called. This method should throw an exception if the operation fails, so that OnExecuteFailed will be fired.
protected OnExecuteStart ( QueueMessageManager manager ) : void
manager QueueMessageManager /// QueueManager instance. Use its Item property to get access to the current method ///
리턴 void

OnGetNextQueueMessage() 보호된 메소드

Message hook that's responsible for retrieving the next message. The base version pulls the next message for the given queue. You can override this method to conditionally override this behavior such as filter when and how messages are read.
protected OnGetNextQueueMessage ( QueueMessageManager manager, string queueName ) : QueueMessageItem
manager QueueMessageManager A manager instance that can retrieve
queueName string The queue to check
리턴 QueueMessageItem

OnNextMessageFailed() 보호된 메소드

Override this method to handle any errors that occured trying to receive the next message from the SQL table. Allows for error handling or logging in your own applications.
protected OnNextMessageFailed ( QueueMessageManager manager, Exception ex ) : void
manager QueueMessageManager /// QueueManager instance. Use its Item property to get access to the current method ///
ex System.Exception /// Exeception that caused the operation to fail ///
리턴 void

OnStartProcessing() 보호된 메소드

Method that is called just before the the controller starts up processing for the queue. If you return false from this method the controller queue is not started.
protected OnStartProcessing ( ) : bool
리턴 bool

OnStopProcessing() 보호된 메소드

Method that is called just before the controller stops processing requests. Use to send messages. If you return false from this method the queue is not stoped.
protected OnStopProcessing ( ) : bool
리턴 bool

PauseProcessing() 공개 메소드

Pauses processing by keeping the thread alive and waiting until the pause is unset
public PauseProcessing ( bool pause = true ) : void
pause bool
리턴 void

QueueController() 공개 메소드

public QueueController ( ) : System
리턴 System

StartProcessing() 공개 메소드

Synchronous Message Processing routine - will process one message after another
public StartProcessing ( ) : void
리턴 void

StartProcessingAsync() 공개 메소드

Starts queue processing asynchronously on the specified number of threads. This is a common scenario for Windows Forms interfaces so the UI stays active while the application monitors and processes the queue on a separate non-ui thread
public StartProcessingAsync ( int threads = -1 ) : void
threads int
리턴 void

StopProcessing() 공개 메소드

Shuts down the Message Processing loop
public StopProcessing ( ) : void
리턴 void