Class MessageCollection
A collection of messages.
Implements
Namespace: Agents.Net
Assembly: Agents.Net.dll
Syntax
public abstract class MessageCollection : IEnumerable<Message>, IDisposable
Remarks
This is a helper class for the MessageCollector<T1, T2>
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Dispose(Boolean)
Disposes all MessageStore<T>s contained in this collection
Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
Remarks
This releases the usage of the message and therefore potentially disposes the contained Message. When a message is used more than once in the MessageCollector<T1, T2>, the Agent that contains the MessageCollector<T1, T2> should mark the message with DelayDispose().
GetAllMessages()
When overridden needs to return all messages in the collection.
Declaration
protected virtual IEnumerable<Message> GetAllMessages()
Returns
Type | Description |
---|---|
IEnumerable<Message> |
GetEnumerator()
Declaration
public IEnumerator<Message> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Message> |
MarkAsConsumed(Message)
Mark the specified message as consumed.
Declaration
public abstract void MarkAsConsumed(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | The message that will be marked. |
Remarks
The usual behavior for the MessageCollector<T1, T2> is to retain all messages that were collected, until other message of the same type replaces the the old message. This method changes that behavior, so that the marked message is removed from the collector afterwards.