Photon Server API
Public Member Functions | Protected Member Functions | Properties | List of all members
ExitGames.Messaging.Channels.MessageQueue< T > Class Template Reference

This class collects messages from a Channel<T> for later use, for example for a http client. More...

Inheritance diagram for ExitGames.Messaging.Channels.MessageQueue< T >:
ExitGames.Messaging.Channels.IMessageQueue< T > ExitGames.Messaging.Channels.LockedMessageQueue< T >

Public Member Functions

 MessageQueue (IFiber executor)
 Initializes a new instance of the MessageQueue<T> class. More...
 
 MessageQueue ()
 Initializes a new instance of the MessageQueue<T> class. More...
 
void Dispose ()
 Disposes the managed and unmanaged resources. More...
 
virtual T Dequeue ()
 Dequeues the next message. More...
 
virtual List< T > Dequeue (int maxCount)
 Dequeues up to the given amount of messages. More...
 
virtual List< T > Dequeue (int maxCount, Func< T, bool > skip)
 Dequeues up to the given amount of messages. More...
 
virtual List< T > DequeueAll ()
 Dequeues all messages. More...
 
virtual List< T > DequeueAll (Func< T, bool > skip)
 Dequeues all messages. More...
 
virtual void Enqueue (T message)
 Enqueues a message. More...
 
virtual bool IsSubscribed (string topic)
 Checks if queue is subscribed to a channel with a certain topic. More...
 
virtual bool Subscribe (string topic, Concurrency.Channels.IChannel< T > channel)
 Subscribes to a Concurrency.Channels.IChannel<T> with a topic. More...
 
virtual bool Unsubscribe (string topic)
 Unsubscribes from a topic channel. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Disposes the managed and unmanaged resources. More...
 

Properties

virtual int Count [get]
 Gets the number of queued message. More...
 
IFiber Executor [get]
 Gets the executing IFiber. More...
 
Queue< T > Messages [get]
 Gets the messages. More...
 
SubscriptionContainer Subscriptions [get]
 Gets the suscriptions. More...
 
- Properties inherited from ExitGames.Messaging.Channels.IMessageQueue< T >
int Count [get]
 Gets the number of queued message. More...
 

Detailed Description

This class collects messages from a Channel<T> for later use, for example for a http client.

Template Parameters
TThe message type.

Instance members of this class are NOT thread safe, all instance members have to be executed with given Executor. The LockedMessageQueue<T> provides thread safe instance members.

Constructor & Destructor Documentation

Initializes a new instance of the MessageQueue<T> class.

Parameters
executorThe executor.

Instances created with this constructor do not dispose the executor at Dispose()

Initializes a new instance of the MessageQueue<T> class.

Member Function Documentation

virtual T ExitGames.Messaging.Channels.MessageQueue< T >.Dequeue ( )
inlinevirtual

Dequeues the next message.

Returns
A message.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual List<T> ExitGames.Messaging.Channels.MessageQueue< T >.Dequeue ( int  maxCount)
inlinevirtual

Dequeues up to the given amount of messages.

Parameters
maxCountThe max number of messages to dequeue.
Returns
A list of messages.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual List<T> ExitGames.Messaging.Channels.MessageQueue< T >.Dequeue ( int  maxCount,
Func< T, bool >  skip 
)
inlinevirtual

Dequeues up to the given amount of messages.

Parameters
maxCountThe max number of messages to dequeue.
skipA message filter.
Returns
A list of messages.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual List<T> ExitGames.Messaging.Channels.MessageQueue< T >.DequeueAll ( )
inlinevirtual

Dequeues all messages.

Returns
A list of messages.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual List<T> ExitGames.Messaging.Channels.MessageQueue< T >.DequeueAll ( Func< T, bool >  skip)
inlinevirtual

Dequeues all messages.

Parameters
skipA message filter.
Returns
A list of messages.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

void ExitGames.Messaging.Channels.MessageQueue< T >.Dispose ( )
inline

Disposes the managed and unmanaged resources.

Multi threaded execution of Unsubscribe, Subscribe and Dispose() is not allowed.

virtual void ExitGames.Messaging.Channels.MessageQueue< T >.Dispose ( bool  disposing)
inlineprotectedvirtual

Disposes the managed and unmanaged resources.

Parameters
disposingTrue if called from Dispose().

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual void ExitGames.Messaging.Channels.MessageQueue< T >.Enqueue ( message)
inlinevirtual

Enqueues a message.

Parameters
messageA message.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual bool ExitGames.Messaging.Channels.MessageQueue< T >.IsSubscribed ( string  topic)
inlinevirtual

Checks if queue is subscribed to a channel with a certain topic.

Parameters
topicThe topic.
Returns
True if subscribed.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual bool ExitGames.Messaging.Channels.MessageQueue< T >.Subscribe ( string  topic,
Concurrency.Channels.IChannel< T >  channel 
)
inlinevirtual

Subscribes to a Concurrency.Channels.IChannel<T> with a topic.

Parameters
topicThe channel topic.
channelThe channel.
Returns
True if resubscribed, false if subscribed first time.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

virtual bool ExitGames.Messaging.Channels.MessageQueue< T >.Unsubscribe ( string  topic)
inlinevirtual

Unsubscribes from a topic channel.

Parameters
topicThe topic.
Returns
True if unsubscribed.

Implements ExitGames.Messaging.Channels.IMessageQueue< T >.

Reimplemented in ExitGames.Messaging.Channels.LockedMessageQueue< T >.

Property Documentation

virtual int ExitGames.Messaging.Channels.MessageQueue< T >.Count
get

Gets the number of queued message.

Gets the executing IFiber.

Queue<T> ExitGames.Messaging.Channels.MessageQueue< T >.Messages
getprotected

Gets the messages.

Gets the suscriptions.