MIM 2016: ECMA2 – Error handing and Batch processing

One of the puzzles I have seen in the MIM ECMA is what do I do when an error is encountered when processing records? If you throw an exception then the whole batch queue is ruined (quite a common occurrence in the MIM MA). But then I would like to capture the exception error so that I see details of what the issue is.

Solution

Create an event log for your ECMA e.g “SAP” say its for an SAP connector. You can do that via PowerShell or C# code. Then in you ECAM code create a function to call the log.

  1. public void MyEventLog(string myLogname, string myMessage, string mySource)  

  2.         {   

  3.                 EventLog eLog = new EventLog(myLogname);  

  4.                 EventLogEntryType myType = EventLogEntryType.Error;

  5.                 myLog.Source = mySource;  

  6.                     eLog.WriteEntry(myMessage, myType);  

  7.     } 

Write to the event log in your ECMA rather than throwing an exception. Here is a sample

  1. catch (Exception ex)  

  2.             {                                  

  3.                 MyEventLog(“SAP”, “EmployeeId: “ + emplID + ” Error Email update of user: “ + ex.Message, “Export AD Info”);  

  4.             }