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
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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