Hello,
we're using TMS Sphinx for a Webapplication.
The Database on the Webserver is replicated with TMS Echo to our local Server and vice versa.
Is it possible to include the Sphinx related Tables (or just the sx_Users table) into that replication process?
We want to update and modify tenant_id and user_type locally.
if not (Setting.Mode.AsUnicodeString='Lokaler Server') then
begin
TEcho(Echo).GetRemoteNode(EchoUrl).Push;
TEcho(Echo).GetRemoteNode(EchoUrl).Pull;
end;
TEcho(Echo).BatchLoad;
TEcho(Echo).Route;
And this is the procedure which initialises the Echo Server
procedure TServerContainer.StartEchoServer;
var
EchoModule: TEchoServerModule;
Pool: IDBConnectionPool;
NodeManager: IEchoNodeManager;
Conn: IDBConnection;
begin
if Assigned(SparkleEchoServer) then
Exit;
SparkleEchoServer := THttpSysServer.Create;
// Echo Server
Pool := AureliusConnection.GetPoolInterface;
EchoModule := TEchoServerModule.Create(EchoUrl, Pool);
SparkleEchoServer.AddModule(EchoModule);
Echo := TEcho.Create(Pool);
// Create regular tables and fields of the application
Conn := Echo.Pool.GetConnection;
// TDatabaseManager.Update(Conn);
// Create tables and fields for TMS Echo usage
TDatabaseManager.Update(Conn, TEcho.Explorer);
Conn := nil; // Free reference
// Get the NodeManager instance
NodeManager := Echo.GetNodeManager;
// If SelfNode is already defined, no need to define it again
if NodeManager.SelfNode = nil then
begin
// SelfNode is not defined, so let's create a Node instance with the name
// specified by the DBName property ("client1", "client2", "server" in the case
// of our demo application. It can be any string value, it just needs
// to be unique among all other databases being replicated.
NodeManager.CreateNode(Setting.NodeName.AsUnicodeString);
// Now define this newly created node as the SelfNode
NodeManager.DefineSelfNode(Setting.NodeName.AsUnicodeString);
Echo.GetRemoteNode(EchoUrl).RegisterNode;
end;
Timer := TSparkleTimer.Create(
procedure(Echo: TObject)
begin
if FRunningTimer then Exit;
FRunningTimer := True;
try
try
if (Setting.Mode.AsUnicodeString='Lokaler Server') then
begin
TEcho(Echo).GetRemoteNode(EchoUrl).Push;
TEcho(Echo).GetRemoteNode(EchoUrl).Pull;
end;
TEcho(Echo).BatchLoad;
TEcho(Echo).Route;
finally
FRunningTimer := False;
end;
except on E: Exception do
MainForm.ApplicationEvents1Exception(self,E);
end;
end,
Echo, 120000, TTimerType.Periodic);
if not SparkleEchoServer.IsRunning then SparkleEchoServer.Start;
end;