IROObjectActivation
Overview
The IROObjectActivation interface is used by the the Remoting SDK to allow service implementations to be notified for activation and deactivation (i.e. before and after they will be asked to serve a remote request). The TROInvoker takes care of it in the TROInvoker and TROInvoker methods.
Depending on your needs, you can use these events to load persist session data, perform cleanup, etc.
Use case
To utilize this possibility you have to add the IROObjectActivation interface to the implementation of your service.
IMyService = IInterface;
TMyService = class(TRORemotable, IMyService, IROObjectActivation)
private
protected
//IROObjectActivation
procedure OnActivate(aClientID: TGUID; const aMessage : IROMessage);
procedure OnDeactivate(aClientID: TGUID);
{ IMyService methods }
//...
procedure SomeMethod;
end;
{ TMyService }
procedure TMyService.OnActivate(aClientID: TGUID; const aMessage: IROMessage);
begin
WriteLn ('OnActivate called');
end;
procedure TMyService.OnDeactivate(aClientID: TGUID);
begin
WriteLn ('OnDeactivate called');
end;
Location
- Unit: uROServerIntf.pas
- Ancestry: IROObjectActivation
Required Methods
OnActivate
Called just after the service is created and before any service method is called.
procedure OnActivate(aClientID: TGUID; const aMessage: IROMessage)
Parameters:
- aClientID: Client ID
- aMessage: Message
OnDeactivate
Called after the service method completes and before the service instance is freed.
procedure OnDeactivate(aClientID: TGUID)
Parameters:
- aClientID: Client ID