using System; namespace PepperDash_Essentials_Core.Queues { /// /// Message class for processing strings via an IQueue /// public class ProcessStringMessage : IQueueMessage { private readonly Action _action; private readonly string _message; /// /// Constructor /// /// Message to be processed /// Action to invoke on the message public ProcessStringMessage(string message, Action action) { _message = message; _action = action; } /// /// Processes the string with the given action /// public void Dispatch() { if (_action == null || String.IsNullOrEmpty(_message)) return; _action(_message); } /// /// To string /// /// The current message public override string ToString() { return _message ?? String.Empty; } } }