Class MessageCollection<T1, T2>
A collection of messages.
Implements
Namespace: Agents.Net
Assembly: Agents.Net.dll
Syntax
public class MessageCollection<T1, T2> : MessageCollection, IDisposable where T1 : Message where T2 : Message
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 |
Remarks
This is a helper class for the MessageCollector<T1, T2>
Constructors
| Improve this Doc View SourceMessageCollection(MessageStore<T1>, MessageStore<T2>, MessageCollector<T1, T2>)
Initialized a new instance of the class MessageCollection<T1, T2>.
Declaration
public MessageCollection(MessageStore<T1> message1, MessageStore<T2> message2, MessageCollector<T1, T2> collector)
Parameters
| Type | Name | Description |
|---|---|---|
| MessageStore<T1> | message1 | Message of type |
| MessageStore<T2> | message2 | Message of type |
| MessageCollector<T1, T2> | collector | The MessageCollector<T1, T2> that produced this instance. |
Properties
| Improve this Doc View SourceMessage1
Message of type T1.
Declaration
public T1 Message1 { get; }
Property Value
| Type | Description |
|---|---|
| T1 |
Message2
Message of type T2.
Declaration
public T2 Message2 { get; }
Property Value
| Type | Description |
|---|---|
| T2 |
Methods
| Improve this Doc View SourceDispose(Boolean)
Disposes all MessageStore<T>s contained in this collection
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | disposing |
Overrides
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 override IEnumerable<Message> GetAllMessages()
Returns
| Type | Description |
|---|---|
| IEnumerable<Message> |
Overrides
| Improve this Doc View SourceMarkAsConsumed(Message)
Mark the specified message as consumed.
Declaration
public override void MarkAsConsumed(Message message)
Parameters
| Type | Name | Description |
|---|---|---|
| Message | message | The message that will be marked. |
Overrides
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.