diff --git a/src/dispatching/polykerma.dispatching.message.pas b/src/dispatching/polykerma.dispatching.message.pas index 475162b..3f67e58 100644 --- a/src/dispatching/polykerma.dispatching.message.pas +++ b/src/dispatching/polykerma.dispatching.message.pas @@ -12,6 +12,7 @@ interface Classes , SysUtils {$ENDIF FPC_DOTTEDUNITS} +, PolyKerma.Dispatching , PolyKerma.Logging ; @@ -19,21 +20,35 @@ interface { TMessage } TMessage = class(TObject) private + FAttachment: String; FChannel: String; - FPayload: String; + FText: String; + FAttachement: TObject; protected public - constructor Create(const AChannel: String); + constructor Create; + constructor Create( + const AChannel: String); + constructor Create( + const AChannel: String; + const AText: String); + constructor Create( + const AChannel: String; + const AText: String; + const AAttachement: TObject); destructor Destroy; override; function Copy: TMessage; property Channel: String read FChannel; - property Payload: String - read FPayload - write FPayload; + property Text: String + read FText + write FText; + property Attachment: String + read FAttachment + write FAttachment; published end; TMessageClass = class of TMessage; @@ -42,12 +57,46 @@ implementation { TMessage } -constructor TMessage.Create(const AChannel: String); +constructor TMessage.Create; +begin + Debug({$I %FILE%}, {$I %LINE%}, 'Message Create'); + FChannel:= cChannelNone; + FText:= EmptyStr; + FAttachement:= nil; +end; + +constructor TMessage.Create( + const AChannel: String); begin Debug({$I %FILE%}, {$I %LINE%}, Format('Message Create: %s', [ AChannel ])); FChannel:= AChannel; end; +constructor TMessage.Create( + const AChannel: String; + const AText: String); +begin + Debug({$I %FILE%}, {$I %LINE%}, Format('Message Create: %s, "%s"', [ + AChannel, + AText + ])); + FChannel:= AChannel; + FText:= AText; +end; + +constructor TMessage.Create( + const AChannel: String; + const AText: String; + const AAttachement: TObject); +begin + Debug({$I %FILE%}, {$I %LINE%}, Format('Message Create: %s, "%s"', [ + AChannel, + AText + ])); + FChannel:= AChannel; + FText:= AText; +end; + destructor TMessage.Destroy; begin Debug({$I %FILE%}, {$I %LINE%}, 'Message Destroy'); @@ -56,8 +105,11 @@ destructor TMessage.Destroy; function TMessage.Copy: TMessage; begin + Debug({$I %FILE%}, {$I %LINE%}, 'Message Copy'); Result:= TMessage.Create(Self.Channel); - Result.Payload:= Self.Payload; + Result.FChannel:= Self.FChannel; + Result.FText:= Self.FText; + Result.FAttachement:= Self.FAttachement; end; end. diff --git a/src/dispatching/polykerma.dispatching.pas b/src/dispatching/polykerma.dispatching.pas index 2b51d67..45b1fe8 100644 --- a/src/dispatching/polykerma.dispatching.pas +++ b/src/dispatching/polykerma.dispatching.pas @@ -13,6 +13,7 @@ interface ;*) const + cChannelNone = 'none'; cChannelControllerOut = 'controller.out'; cChannelControllerIn = 'controller.in'; cChannelCommsOut = 'comms.out';