Event Sink


I create event sink server which monitor the active connection.

When I shutdown the server and there is a connected client , the server show a error ROEventRepository.Message must be assigned. I checked it is really assigned.

How to solve this issue?


Pls specify what exactly TROEventRepository descendant you are using

TROInMemoryEventRepository, Latest SDK and delphi 10.3.3 , win10

I Follow the SuperTCPChannelChat and put the following shutdown event code in servdermodule ondestroy event:

procedure TServerDataModule.DataModuleDestroy(Sender: TObject);
ev: IChatEvents_Writer;
ev := (ROEventRepository as IChatEvents_Writer);
Sleep(2000); // allow clients to gracefully logout.

The other eventsink method is correct. Just this Shutdown event client did not receive.

Please advise.

In SuperTCPChannelChat we used FormCloseQuery event - this event is fired when components in Datamodule weren’t destroyed yet.

i.e. it sends notifications, and after this close main form.
In your case, some components could be destroyed, like message component, and it is a reason why ROEventRepository.Message is nil.

Then is it a issue or not? How to handle is better , as I need run in a service mode.

Also why the shutdown function not sink to client ? How to check ? as all other function is working only this shutdown not working.

you should extract that code into personal method and call it before your data module is freed, like


If i need achieve is when the server in service mode, before shutdown/Destroy, in which module/event I can notice client to disconnect from server ?

For example, execute “datamodule.shutdown”
Any advice?


for Windows Service template, you can use OnStop event, like

procedure TService1.ServiceStop(Sender:TService; var Stopped:Boolean);
  // add here your code
  RoServer.Active := false;