Show/Hide Toolbars

TMS Echo Documentation

Routing is the process of processing logged changes and create batches targeting each remote node registered to receive data. This is a more detailed description of the routing mechanism:


1.Get a list of the logged changes that has not been routed yet (status is "unrouted");

2.Create a batch for each registered remote node;

3.Include the list of changes in the batch, so those changes are scheduled to be sent to that specific node;

4.Flag the list of logged changes as routed (status becomes "routed") so they are not sent again.


Once batches are created, they can be transfered to the remote nodes.

To execute the routing process, you just need to call TEcho.Route method:




And that is enough. It's important that you call Route from time to time in your application to create the batches. If you don't do so, batches are never created, and data is never transferred. It's up to you to decide the best way (how and when) you should execute the routing process.


It's also while routing that you can filter which data is transferred to each node. For example, supposed you are routing data at the server database to two different nodes, "Client1" and "Client2", and you don't want to send invoices to Client1. You can implement a custom logic this way:


uses {...}, Echo.Main, Echo.Entities;



    procedure(Log: TEchoLog; Node: TEchoNode; var Route: boolean)


      if SameText(Log.EntityClass, 'AppEntities.TEchoInvoice')

        and (Node.Id = 'Client1'then

        Route := false;




The above code means: if you are routing to the node with id "Client1", and you are trying to route a change in an object of class "AppEntities.TEchoInvoice", then don't route it.

So any change in TEchoInvoice object will only be send to "Client2", not "Client1".

Be aware that routing happens on both client and server side (or in better words, in all nodes) so you need to know exactly the source code (local database) and the target node (Node parameter) to implement your logic.