Photon Server API

Public Member Functions | Protected Member Functions | Properties | List of all members
ExitGames.Messaging.MessageQueueReader Class Referenceabstract

Reads messages from MessageQueues, dispatches them, and checks for dispatch timeouts More...

Inheritance diagram for ExitGames.Messaging.MessageQueueReader:

Public Member Functions

void BeginStop ()
 The begin stop. More...
 
bool EndStop (int waitSeconds)
 waits until reading stops or timeout expired More...
 
void Start ()
 Creates a listening thread and starts it. While running, the thread will listen to the specified message queue and dispatch incoming messages by calling the abstract method DispatchMessage. If UsePeeking is set to true, no messages will be lost if an error occurs during the procession of the message. More...
 
void Stop ()
 Stops the reader thread, throws TimeoutException if not stopped within 1 minute. More...
 
bool Stop (int waitSeconds)
 Stops the reader thread. More...
 
void Dispose ()
 The dispose. More...
 

Protected Member Functions

 MessageQueueReader (string msmq)
 Initializes a new instance of the MessageQueueReader class. More...
 
abstract void DispatchMessage (Message message)
 Implementors should provide functionality to process the received message. More...
 
virtual void Dispose (bool disposing)
 The dispose. More...
 
virtual IMessageFormatter GetFormatter ()
 Returns a formatter for the messages of the queue. More...
 
virtual void OnException (Exception ex)
 The on exception. More...
 
virtual void OnStart (MessageQueue messageQueue)
 The on start. More...
 
virtual void OnStop (MessageQueue messageQueue)
 The on stop. More...
 

Properties

string Path [get]
 returns the message queue format name More...
 
bool Stopped [get]
 Gets a value indicating whether Stopped. More...
 
virtual TimeSpan DispatchTimeout [get]
 Timeout for message processing, after timeout occurs a TimeoutException More...
 
virtual bool DoCreateMessageQueueIfNotExists [get]
 Gets a value indicating whether DoCreateMessageQueueIfNotExists. More...
 
abstract ILogger Log [get]
 Gets Log. More...
 
virtual int MaxDispatchTimeouts [get]
 reading stops if more timeouts occur at a time More...
 
virtual int MaxThreads [get]
 returns 1 if not overidden More...
 
virtual bool PurgeOnStart [get]
 set true to purge messages on start More...
 
virtual bool UsePeeking [get]
 Gets a value indicating whether to use MessageQueue.Peek() instead of MessageQueue.Receive() to receive messages. If UsePeeking is set to true, messages will not be lost if an error occurs during procession of the message. More...
 
virtual TimeSpan WaitTime [get]
 Gets the time the listening thread should wait for an incoming message. Stopping is delayed by this timespan. More...
 

Detailed Description

Reads messages from MessageQueues, dispatches them, and checks for dispatch timeouts

Constructor & Destructor Documentation

◆ MessageQueueReader()

ExitGames.Messaging.MessageQueueReader.MessageQueueReader ( string  msmq)
inlineprotected

Initializes a new instance of the MessageQueueReader class.

Parameters
msmqThe path of the MessageQueue to which the reader thread should listen.

Member Function Documentation

◆ BeginStop()

void ExitGames.Messaging.MessageQueueReader.BeginStop ( )
inline

The begin stop.

◆ DispatchMessage()

abstract void ExitGames.Messaging.MessageQueueReader.DispatchMessage ( Message  message)
protectedpure virtual

Implementors should provide functionality to process the received message.

Parameters
messageThe message received by the message queue listen thread.

◆ Dispose() [1/2]

void ExitGames.Messaging.MessageQueueReader.Dispose ( )
inline

The dispose.

◆ Dispose() [2/2]

virtual void ExitGames.Messaging.MessageQueueReader.Dispose ( bool  disposing)
inlineprotectedvirtual

The dispose.

Parameters
disposingThe disposing.

◆ EndStop()

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

waits until reading stops or timeout expired

Parameters
waitSecondstimeout
Returns
true if stopped successfully, otherwise false

◆ GetFormatter()

virtual IMessageFormatter ExitGames.Messaging.MessageQueueReader.GetFormatter ( )
inlineprotectedvirtual

Returns a formatter for the messages of the queue.

Returns
A BinaryMessageFormatter if method is not overriden.

◆ OnException()

virtual void ExitGames.Messaging.MessageQueueReader.OnException ( Exception  ex)
inlineprotectedvirtual

The on exception.

Parameters
exThe ex.

◆ OnStart()

virtual void ExitGames.Messaging.MessageQueueReader.OnStart ( MessageQueue  messageQueue)
inlineprotectedvirtual

The on start.

Parameters
messageQueueThe message queue.

◆ OnStop()

virtual void ExitGames.Messaging.MessageQueueReader.OnStop ( MessageQueue  messageQueue)
inlineprotectedvirtual

The on stop.

Parameters
messageQueueThe message queue.

◆ Start()

void ExitGames.Messaging.MessageQueueReader.Start ( )
inline

Creates a listening thread and starts it. While running, the thread will listen to the specified message queue and dispatch incoming messages by calling the abstract method DispatchMessage. If UsePeeking is set to true, no messages will be lost if an error occurs during the procession of the message.

◆ Stop() [1/2]

void ExitGames.Messaging.MessageQueueReader.Stop ( )
inline

Stops the reader thread, throws TimeoutException if not stopped within 1 minute.

◆ Stop() [2/2]

bool ExitGames.Messaging.MessageQueueReader.Stop ( int  waitSeconds)
inline

Stops the reader thread.

Parameters
waitSecondsThe wait seconds.
Returns
The stop.

Property Documentation

◆ DispatchTimeout

virtual TimeSpan ExitGames.Messaging.MessageQueueReader.DispatchTimeout
getprotected

Timeout for message processing, after timeout occurs a TimeoutException

2 minutes if property is not overridden.

◆ DoCreateMessageQueueIfNotExists

virtual bool ExitGames.Messaging.MessageQueueReader.DoCreateMessageQueueIfNotExists
getprotected

Gets a value indicating whether DoCreateMessageQueueIfNotExists.

◆ Log

abstract ILogger ExitGames.Messaging.MessageQueueReader.Log
getprotected

Gets Log.

◆ MaxDispatchTimeouts

virtual int ExitGames.Messaging.MessageQueueReader.MaxDispatchTimeouts
getprotected

reading stops if more timeouts occur at a time

default value is 9

◆ MaxThreads

virtual int ExitGames.Messaging.MessageQueueReader.MaxThreads
getprotected

returns 1 if not overidden

◆ Path

string ExitGames.Messaging.MessageQueueReader.Path
get

returns the message queue format name

◆ PurgeOnStart

virtual bool ExitGames.Messaging.MessageQueueReader.PurgeOnStart
getprotected

set true to purge messages on start

false if not overridden

◆ Stopped

bool ExitGames.Messaging.MessageQueueReader.Stopped
get

Gets a value indicating whether Stopped.

◆ UsePeeking

virtual bool ExitGames.Messaging.MessageQueueReader.UsePeeking
getprotected

Gets a value indicating whether to use MessageQueue.Peek() instead of MessageQueue.Receive() to receive messages. If UsePeeking is set to true, messages will not be lost if an error occurs during procession of the message.

true if MessageQueue.Peek should be used; false if MessageQueue.Receive should be used. Returns false if method is not overridden.

◆ WaitTime

virtual TimeSpan ExitGames.Messaging.MessageQueueReader.WaitTime
getprotected

Gets the time the listening thread should wait for an incoming message. Stopping is delayed by this timespan.

10 seconds if property is not overridden.