Photon Server API
Classes | Public Member Functions | Properties | Events | List of all members
ExitGames.Messaging.ThrottledMessageQueueReader Class Reference

This class can read multiple message queues and dispatch the messages of each queue with a different priority. More...

Inheritance diagram for ExitGames.Messaging.ThrottledMessageQueueReader:

Public Member Functions

 ThrottledMessageQueueReader (params string[] messageQueuePaths)
 Initializes a new instance of the ThrottledMessageQueueReader class. More...
 
delegate void MessageDispatchEventHandler (ThrottledMessageQueueReader reader, ThrottledMessageQueue queue, Message message)
 The message dispatch event handler. More...
 
void BeginStop ()
 Begins to stop the reader. More...
 
bool EndStop (int waitSeconds)
 waits until reading stops or timeout expires More...
 
void InvokeError (Exception ex)
 The invoke error. More...
 
void InvokeTimeout (Message message)
 The invoke timeout. More...
 
void Start ()
 Starts message receiving and dispatching. More...
 
bool Stop (int waitSeconds)
 Stops the message receiving (and dispatching). More...
 
void Stop ()
 Stops the message receiving (and dispatching). More...
 
void Dispose ()
 Stops and disposes the reader and all queues. More...
 

Properties

TimeSpan DispatchInterval [get, set]
 Gets or sets the time span for each dispatch interval. The max number of dispatched messages per interval is set with MaxDispatchCountPerInterval. The default number of dispatched messages per queue and interval is set with ThrottledMessageQueue.DispatchCountPerInterval. Messages are dispatched until no messages are available or until MaxDispatchCountPerInterval is reached. More...
 
TimeSpan DispatchTimeout [get, set]
 Gets or sets the dispatch timeout. After the timeout expires a new dispatch slot is opened. The reader stops if the number of timeouts exceeds MaxDispatchTimeoutCount. More...
 
bool IsStopped [get]
 Gets a value indicating whether all listeners are stopped. More...
 
bool IsStoppedAny [get]
 Gets a value indicating whether IsStoppedAny. More...
 
ILogger Logger [get, set]
 Gets or sets the logger. More...
 
int MaxDispatchCountPerInterval [get, set]
 Gets or sets the maxmimum number of messages that can be dispatched per DispatchInterval. More...
 
int MaxDispatchTimeoutCount [get, set]
 Gets or sets the maximum allowed dispatch timeouts before stopping More...
 
IMessageFormatter MessageFormatter [get, set]
 Gets or sets the MessageQueue.Formatter. More...
 
ThrottledMessageQueue[] MessageQueues [get]
 Gets the MessageQueues. More...
 
string Paths [get]
 Gets the message queue paths separated with a semicolon. More...
 
TimeSpan PeekTimeout [get, set]
 Gets or sets PeekTimeout. This setting will delay the stop time. More...
 
ThrottledMessageQueueReaderState State [get]
 Gets State. More...
 

Events

MessageDispatchEventHandler Dispatch
 The dispatch event. More...
 
Action< ThrottledMessageQueueReader, Exception > Error
 The error. More...
 
Action< ThrottledMessageQueueReaderStopped
 The stopped event. More...
 
Action< ThrottledMessageQueueReader, Message > Timeout
 The timeout. More...
 

Detailed Description

This class can read multiple message queues and dispatch the messages of each queue with a different priority.

Constructor & Destructor Documentation

ExitGames.Messaging.ThrottledMessageQueueReader.ThrottledMessageQueueReader ( params string[]  messageQueuePaths)
inline

Initializes a new instance of the ThrottledMessageQueueReader class.

Parameters
messageQueuePathsThe message Queue Paths.

Member Function Documentation

void ExitGames.Messaging.ThrottledMessageQueueReader.BeginStop ( )
inline

Begins to stop the reader.

void ExitGames.Messaging.ThrottledMessageQueueReader.Dispose ( )
inline

Stops and disposes the reader and all queues.

bool ExitGames.Messaging.ThrottledMessageQueueReader.EndStop ( int  waitSeconds)
inline

waits until reading stops or timeout expires

Parameters
waitSecondstimeout
Returns
true if stopped successfully, otherwise false
void ExitGames.Messaging.ThrottledMessageQueueReader.InvokeError ( Exception  ex)
inline

The invoke error.

Parameters
exThe ex.
void ExitGames.Messaging.ThrottledMessageQueueReader.InvokeTimeout ( Message  message)
inline

The invoke timeout.

Parameters
messageThe message.
delegate void ExitGames.Messaging.ThrottledMessageQueueReader.MessageDispatchEventHandler ( ThrottledMessageQueueReader  reader,
ThrottledMessageQueue  queue,
Message  message 
)

The message dispatch event handler.

Parameters
readerThe reader.
queueThe queue.
messageThe message.
void ExitGames.Messaging.ThrottledMessageQueueReader.Start ( )
inline

Starts message receiving and dispatching.

Exceptions
InvalidOperationExceptionalready started
bool ExitGames.Messaging.ThrottledMessageQueueReader.Stop ( int  waitSeconds)
inline

Stops the message receiving (and dispatching).

Parameters
waitSecondsThe wait seconds.
Returns
true if stopped in time.
void ExitGames.Messaging.ThrottledMessageQueueReader.Stop ( )
inline

Stops the message receiving (and dispatching).

Exceptions
TimeoutExceptiontimeout expired

Property Documentation

TimeSpan ExitGames.Messaging.ThrottledMessageQueueReader.DispatchInterval
getset

Gets or sets the time span for each dispatch interval. The max number of dispatched messages per interval is set with MaxDispatchCountPerInterval. The default number of dispatched messages per queue and interval is set with ThrottledMessageQueue.DispatchCountPerInterval. Messages are dispatched until no messages are available or until MaxDispatchCountPerInterval is reached.

default: TimeSpan.Zero = no throttling

TimeSpan ExitGames.Messaging.ThrottledMessageQueueReader.DispatchTimeout
getset

Gets or sets the dispatch timeout. After the timeout expires a new dispatch slot is opened. The reader stops if the number of timeouts exceeds MaxDispatchTimeoutCount.

default: 2 minutes

bool ExitGames.Messaging.ThrottledMessageQueueReader.IsStopped
get

Gets a value indicating whether all listeners are stopped.

bool ExitGames.Messaging.ThrottledMessageQueueReader.IsStoppedAny
get

Gets a value indicating whether IsStoppedAny.

ILogger ExitGames.Messaging.ThrottledMessageQueueReader.Logger
getset

Gets or sets the logger.

int ExitGames.Messaging.ThrottledMessageQueueReader.MaxDispatchCountPerInterval
getset

Gets or sets the maxmimum number of messages that can be dispatched per DispatchInterval.

int ExitGames.Messaging.ThrottledMessageQueueReader.MaxDispatchTimeoutCount
getset

Gets or sets the maximum allowed dispatch timeouts before stopping

default: 9

IMessageFormatter ExitGames.Messaging.ThrottledMessageQueueReader.MessageFormatter
getset

Gets or sets the MessageQueue.Formatter.

default: BinaryMessageFormatter

ThrottledMessageQueue [] ExitGames.Messaging.ThrottledMessageQueueReader.MessageQueues
get

Gets the MessageQueues.

string ExitGames.Messaging.ThrottledMessageQueueReader.Paths
get

Gets the message queue paths separated with a semicolon.

TimeSpan ExitGames.Messaging.ThrottledMessageQueueReader.PeekTimeout
getset

Gets or sets PeekTimeout. This setting will delay the stop time.

default: 5 seconds

ThrottledMessageQueueReaderState ExitGames.Messaging.ThrottledMessageQueueReader.State
get

Gets State.

Event Documentation

MessageDispatchEventHandler ExitGames.Messaging.ThrottledMessageQueueReader.Dispatch

The dispatch event.

Action<ThrottledMessageQueueReader, Exception> ExitGames.Messaging.ThrottledMessageQueueReader.Error

The error.

Action<ThrottledMessageQueueReader> ExitGames.Messaging.ThrottledMessageQueueReader.Stopped

The stopped event.

Action<ThrottledMessageQueueReader, Message> ExitGames.Messaging.ThrottledMessageQueueReader.Timeout

The timeout.