OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: Integer; TotalRecIn: IDictionary; TotalRecOut: IDictionary; ErrorRec: IDictionary);
Task. ETL task.
Object. ETL task object.
Duration. Block execution time in milliseconds.
TotalRecIn. Source table of records.
TotalRecOut. Consumer table of records.
ErrorRec. Table of skipped error records.
The OnEndBlock method implements ETL task block finish event.
ETL task block is a set of two objects and a link between them in the ETL task.
The following must be created for the TotalRecIn, TotalRecOut, ErrorRec parameters:
A table with the fields:
Id. Source table record identifier.
Value. Source table record value.
A table with the fields:
Id. Consumer table record identifier.
Value. Consumer table record value.
A table with the fields:
Id. Consumer table record identifier.
Value. Consumer table skipped record value.
To implement the event that occurs on ETL task block start, use IEtlTaskExecutionEvents.OnStartBlock.
To determine a Fore object used as an event handler, and the class described in this object, use the IEtlTask.EventsAssembly and IEtlTask.EventsClass properties.
The example describes a class that can be used as ETL task event handler.
Add links to the Collections, Etl, Ui system assemblies.
Class EventsClass: EtlTaskExecutionEvents
// Event that occurs on ETL task start
Public Sub OnStartTask(Task: IEtlTask);
Begin
WinApplication.InformationBox("The OnStartTask event" + #13 + #10 +
"Number of ETL task objects = " + Task.Count.ToString);
End Sub OnStartTask;
// Event that occurs on ETL task end
Public Sub OnEndTask(Task: IEtlTask; Duration, TotalRec, ErrorRec: Integer);
Begin
WinApplication.InformationBox("The OnEndTask event" + #13 + #10 +
"Number of ETL task objects = " + Task.Count.ToString + #13 + #10 +
"Task execution progress = " + Duration.ToString + #13 + #10 +
"Number of records at input = " + TotalRec.ToString + #13 + #10 +
"Number of skipped records at output = " + ErrorRec.ToString);
End Sub OnEndTask;
// Event that occurs on ETL task block start
Public Sub OnStartBlock(Task: IEtlTask; Object: IEtlObject);
Begin
WinApplication.InformationBox("The OnStartBlock event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id);
End Sub OnStartBlock;
// Event that occurs on finishing ETL task block
Public Sub OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: Integer; TotalRecIn, TotalRecOut, ErrorRec: IDictionary);
Begin
WinApplication.InformationBox("The OnEndBlock event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id + #13 + #10 +
"Task execution progress = " + Duration.ToString + #13 + #10 +
"Number of records at input = " + TotalRecIn.Count.ToString + #13 + #10 +
"Number of records at input = " + TotalRecOut.Count.ToString + #13 + #10 +
"Number of skipped records at output = " + ErrorRec.Count.ToString);
End Sub OnEndBlock;
// Event that occurs during ETL task execution
Public Sub OnProgress(Task: IEtlTask; Progress: Integer);
Begin
WinApplication.InformationBox("The OnProgress event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"Task execution progress = " + Progress.ToString);
End Sub OnProgress;
// Event that occurs on ETL task block error
Public Sub OnError(Task: IEtlTask; Object: IEtlObject; Excep: IException);
Begin
WinApplication.InformationBox("The OnError event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id + #13 + #10 +
"Error text - " + Excep.Message);
End Sub OnError;
End Class EventsClass;
After executing the example the information message is displayed if the event occurs.
See also: