TMS Echo Status and Flags

Hi,

i'm using TMS Echo and run recently in some accessviolation Error on replication on my clients.
When i restart the replication, after a few attempts the error vanishes.
In the Echo_Load_Error Table i got some of these errors: [FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0]Operation canceled

Could it be that there is a problem with the firedac timeout?
Will the errors be processed through TMS Echo are the Errors inside the Echo_Load_Error final and have to be resolved through me?

Thank you and kind regards

That is very hard to tell without proper reproducing and debugging.

Unfortunately, it's all up to you. Echo will provide you with a list of items that failed to be loaded and you have to resolve the items yourself.

Here is a rough example:

  Engine := TEchoRemoteEngine.Create('http://localhost:2001/tms/echo');
  ErrorBatches := Engine.GetFailedIncomingBatches;
  for var Batch in ErrorBatches do
    for var Log in Batch.Log do
      if Log.Error.Status = TLoadErrorStatus.Pending then
      begin
        ShowMessage(Log.Log.Entity);
 
        // Reprocess
        Log.Error.ResolvedEntity := Log.Log.Entity; // Modify Log.Log.Entity if needed
        
        // Enable ping back mode only if you want the resolved entity
        // to be replicated back to the origin server
        // Log.Error.PingBackMode := TPingBackMode.ResendObject;
        Engine.MergeError(Log.Error);
      end;

Ok

is your "rough example" only pseudo Code or are some of these procedures available?
I couldn't find anything regarding error handling in the developers Guide.

Thanks for your help

Everything is available, but depending on the nature of the error you have to solve it yourself (e.g., modify the entity so that it doesn't conflict with your existing data).

Since your errors seem to be only due to bad database connection, probably the provide code would be enough, since it's just a retry.

Hey Wagner,

so i tried your code but get an access violation evertyime i call TEchoRemoteEngine but get the error "EntityDoesNotExists".
I checked the Echo_Load_Error table an noticed, that the coloum "Resolved_Entity" is empty in every row.

I'm catching exceptions via the folowing code

procedure TMainForm.ApplicationEvents1Exception(Sender: TObject; E: Exception);
var
  Filename: string;
  LogFile: TextFile;
begin
  // prepares log file
  Filename := ChangeFileExt (Application.Exename, '.log');
  AssignFile (LogFile, Filename);
  if FileExists (FileName) then
    Append (LogFile) // open existing file
  else
    Rewrite (LogFile); // create a new one
  try
    // write to the file and show error
    Writeln (LogFile, DateTimeToStr (Now) + ':' + E.Message);
//    Application.ShowException (E);
  finally
    // close the file
    CloseFile (LogFile);
  end;
end;

and here i get the entities listed.
Echo Error Log Example.txt (3.8 KB)

When i call the tms/echo/EchoLoadError in my browser i get the following output

    {
        "$id": 58,
        "@xdata.type": "XData.Default.EchoLoadError",
        "Id": 58,
        "ErrorCode": "EMSSQLNativeException",
        "ErrorMessage": "[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0]Operation canceled",
        "Status": "Solved",
        "ResolvedEntity": "",
        "PingBackMode": "Off"
    },
    {
        "$id": 59,
        "@xdata.type": "XData.Default.EchoLoadError",
        "Id": 59,
        "ErrorCode": "EMSSQLNativeException",
        "ErrorMessage": "[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0]Operation canceled",
        "Status": "Solved",
        "ResolvedEntity": "",
        "PingBackMode": "Off"
    },
    {
        "$id": 60,
        "@xdata.type": "XData.Default.EchoLoadError",
        "Id": 60,
        "ErrorCode": "EMSSQLNativeException",
        "ErrorMessage": "[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0]Operation canceled",
        "Status": "Solved",
        "ResolvedEntity": "",
        "PingBackMode": "Off"
    },

I'm a little bit confused with the status "solved" and what i can do to resolve this without the entity beeing saved into the database.

I really don't know what's going on. Maybe the error happens exactly when it's trying to save the error. Hard to tell. For more details I'd need to reproduce and debug the issue.

I think you should really try to solve the operation canceled error. You are using an old and deprecated SQL Server client, have you tried using a different, newer one?