Can not get Events working

Hello,

It seems i am missing something about setting up an events, but i could not get them propagate to client.

Delphi 2007, RO 9.2.103.1311.

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.

Thank you.

try to add ExcludeSender := False; like

Thanks Evgeny, it did not help. I tried to add RegisterEventClient, playing with LegacyEvents (BTW what is it for) etc.

Is there a way i can email my test project so you can take a look?

pls read Event Sinks and Server Callbacks. it describes difference between legacy (i.e. LegacyEvents = true) and .NET-compatible modes.

yes, you can send it to support@.

Note: these samples: HTTP Chat, SuperHTTP Chat and SuperTCP Channel Chat demonstrate usage of .NET-compatible mode.

Thank you Evgeny, i got it working. I missed a few bits in client side implementation.

Do i necessarily need to add to SessionList before calling?

vEV := (FEventRepository as IReportEvent_Writer);
vEV.SessionList.Add(GUIDTOString(FSessionID));
vEV.ExcludeSender := FALSE;
vEV.ReportProgress(FSessionID, GuidToString(FClientReportID), AProgress);

you should specify SessionList only if you want to send event to specific set of clients. if SessionList is empty, event will be sent to all clients.