Quasar/Quasar.Common/Messages/IMessageProcessor.cs

32 lines
1.2 KiB
C#
Raw Normal View History

using Quasar.Common.Networking;
2018-08-25 16:12:44 +00:00
namespace Quasar.Common.Messages
{
/// <summary>
/// Provides basic functionality to process messages.
/// </summary>
public interface IMessageProcessor
2018-08-25 16:12:44 +00:00
{
/// <summary>
/// Decides whether this message processor can execute the specified message.
/// </summary>
/// <param name="message">The message to execute.</param>
/// <returns><c>True</c> if the message can be executed by this message processor, otherwise <c>false</c>.</returns>
2018-08-25 16:12:44 +00:00
bool CanExecute(IMessage message);
/// <summary>
/// Decides whether this message processor can execute messages received from the sender.
/// </summary>
/// <param name="sender">The sender of a message.</param>
/// <returns><c>True</c> if this message processor can execute messages from the sender, otherwise <c>false</c>.</returns>
2018-08-25 16:12:44 +00:00
bool CanExecuteFrom(ISender sender);
/// <summary>
/// Executes the received message.
/// </summary>
/// <param name="sender">The sender of this message.</param>
/// <param name="message">The received message.</param>
2018-08-25 16:12:44 +00:00
void Execute(ISender sender, IMessage message);
}
}