Hi,
Using Delphi 12.2, RODA 10.0.0.1607
Having a service
type
[ROService(SvcEvents, SvcEventsID)]
[RONamespace(__RODLLibraryNamespace)]
[ROSynchronizedSingletonClassFactory]
TServiceEvents = class(TRORemoteDataModule, IServiceEvents)
erEvents: TROInMemoryEventRepository;
procedure RORemoteDataModuleCreate(Sender: TObject);
private
public
[ROServiceMethod]
procedure SendMessage(const aMessage: string);
end;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
uses
Services.Panacee,
Units.Logging;
procedure TServiceEvents.RORemoteDataModuleCreate(Sender: TObject);
begin
inherited;
SessionManager := PanaceeService.smSessions;
end;
procedure TServiceEvents.SendMessage(const aMessage: string);
var
aEvent: IROEventWriter<ICommonEvents>;
begin
Log.Log(ltInfo, ClassName, 'Service Events SendMessage', 'Session: ' + Session.SessionID.ToString);
aEvent := erEvents.GetWriter<ICommonEvents>(Session.SessionID);
aEvent.ExcludeSender := False;
aEvent.ExcludeSessionList := True;
aEvent.Event.OnSendMessage(aMessage);
end;
initialization
RegisterCodeFirstService(TServiceEvents);
On clientside
type
TEventMediator = class(TComponent, ICommonEvents)
private
FEventReceiver: TROEventReceiver;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure RegisterEvents;
procedure UnregisterEvents;
procedure OnSendMessage(const aMessage: UnicodeString);
end;
procedure TEventMediator.RegisterEvents;
begin
FEventReceiver.Interval := 1000;
FEventReceiver.Channel := PanaceeSvc.chHTTP;
FEventReceiver.Message := PanaceeSvc.msgBIN;
FEventReceiver.ServiceName := 'ServiceEvents';
FEventReceiver.RegisterEventHandlers([EID_CommonEvents],[Self]);
FEventReceiver.Activate;
end;
So, client starts (just login) and calls RegisterEvents which is nothing more than setting some properties of the TROEventReceiver and activate it.
Stopping the server (or service) results in a memory leak of TROBinaryMemoryStream.
What is wrong in this?
Regards,
Filip