Event is not triggered

I added the following code to the XData demo (server).

But the event never fires.

EchoModule.Events.OnEntityInserted.Subscribe(
  procedure ( Args : TEntityInsertedArgs )
  begin
    // my code
  end
);

Where is my mistake?

TMS Echo server doesn't publish any automatic CRUD endpoint, everything is communicated via service operations. Thus it's expected that such event never fires.

Is there any other way to know which entities are being inserted/edited/deleted via echo replication?

You can use the regular Aurelius events for the model of your application: Events | TMS Aurelius documentation

The event is also not triggered...

procedure StartServer;
var
//  Module : TXDataServerModule;
  EchoModule: TEchoServerModule;
  Pool: IDBConnectionPool;
  NodeManager: IEchoNodeManager;
  Conn: IDBConnection;
begin
  if Assigned(SparkleServer) then
     Exit;

  TMappingExplorer.Default.Events.OnInserted.Subscribe(
    procedure(Args: TInsertedArgs)
    begin
      with TStringList.Create do
      begin
        if FileExists( 'logs.txt' ) = True then
          LoadFromFile('logs.txt');

        Add( FormatDateTime('dd/mm/yyyy hh:nn:ss.zzz', Now) + ' - ' + Args.Entity.ClassName );
        SaveToFile('logs.txt');
        Free;
      end;
    end
  );

  // rest of the code

Hi !
I still don't use TMS Echo. To make the replication, does it relay on purely model objects manipulation, or on Aurelius insert/update/delete SQL sentences generated on source nodes? If the latter, i think it wouldn`t fire Aurelius events when replicating on target nodes. Does it work this way?

BTW, I noticed something with your log routine: It's reading the whole file and rewriting it.
If TMS Logging is not an option right now, I would recommend something like:

procedure SaveLOG(const AMessage, AFileName : string);
var
  F: TextFile;

begin
   tthread.Queue(nil, procedure begin
   AssignFile(F, AFileName);
   try
      append(f);
   except
      rewrite(f);
   end;
   writeln(f, FormatDateTime('dd/MM/YYYY HH:mm:ss', now) + ' - ' + AMessage);
   closefile(f);
   end
   );
end;

and then call SaveLOG(Args.Entity.ClassName, 'logs.txt');

Sorry, I think here is the answer to my question:

In that topíc, by "client" you mean target node? And "All echo operations are done through Aurelius" includes saving data on target node?

@Giovani_Lagemann_Erthal ,
TMappingExplorer.Default.Events.OnInserted.Subscribe - I know it works. I use it in "normal" Aurelius applications. Cannot help on TMS Echo firing events or not. Sorry.

The code is irrelevant. It's just to test if the event is being fired (which is not the case).

I use Aurelius Events in my applications. However, they are not being called during the replication process (echo).

Anyway, thanks for the help!

Sorry. Indeed, after reviewing TMS Echo code, I see that events are not triggered. For performance and other reasons, Echo uses low level methods for database operations, thus the code that fires events is never reached.