2020-05-28 19:10:26 +00:00
|
|
|
|
using Quasar.Common.Networking;
|
2018-08-25 16:12:44 +00:00
|
|
|
|
|
|
|
|
|
namespace Quasar.Common.Messages
|
|
|
|
|
{
|
2020-05-28 19:10:26 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides basic functionality to process messages.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IMessageProcessor
|
2018-08-25 16:12:44 +00:00
|
|
|
|
{
|
2020-05-28 19:10:26 +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);
|
2020-05-28 19:10:26 +00:00
|
|
|
|
|
|
|
|
|
/// <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);
|
2020-05-28 19:10:26 +00:00
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
}
|
|
|
|
|
}
|