It seems i am missing something about setting up an events, but i could not get them propagate to client.
Delphi 2007, RO 22.214.171.1241.
I have EventRepository property set for service, it is TROInMemoryEventRepository. EventRepository is connected to separate Channel component placed on this service, and SessionManager located in server datamodule.
LegacyEvents is set to TRUE both in service and on client side, in EventReceiver component.
Service’ SessionManager property it set to the same TROInMemorySessionManager located in Server Datamodule. There is of course DataStreamer component placed in service.
RequiresSession is set to TRUE on service, and i do Login/Logout implemented.
Now i have a service method, it is being called from client, it is lengthy operation and server should report the progress back to client during the operation. Like this
procedure TIdlsReport.SendProgress(const AProgress: integer); var vEV: IReportEvent_Writer; begin CodeSite.EnterMethod(Self, 'SendProgress'); if not Assigned(FEventRepository) then exit; vEV := (FEventRepository as IReportEvent_Writer); vEV.ReportProgress(FSessionID, GuidToString(FClientReportID), AProgress); CodeSite.ExitMethod(Self, 'SendProgress'); end;
TIdlsReport is a class that handles the operation, and FSessionID and EventRepository are being passed from a service method that creates instance of the class.
On client side, i have TROEventReceiver component, connected to main Channel component (i know it is better to create separate channel, tried that as well), linked to IdlsReportsService, and Interval is set to 1000.
On login i activate event receiver
vSL := TStringList.create; try vSL.add(GetIPAddress); vAuthService := CoIdlsAuthService.Create(ROMessage, ROChannel); if vAuthService.Login(eUsername.text, ePassword.text, vSL.CommaText, vUserInfo) then begin lUserInfo.caption := 'User is logged in. User ID: ' + vUserInfo.UserID; FUserID := strToInt(vUserInfo.UserID); EventReceiver.RegisterEventHandlers([EID_ReportEvent], [Self]); EventReceiver.Activate; end else ShowMessage('login failed') finally vSL.free end;
And here is the event implementation on client that is never being called for some reason
procedure TfrmIdlsROTestClientMain.OnReportProgress(const AClientReportID: TGUID; const AProgress: integer); begin ProgressBar1.Position := AProgress; Memo1.Lines.Add('Progress received: ' + intTostr(AProgress)); end;
Any advice would be greatly appreciated.