Question

I have a Rhino ETL process that performs several sequential actions, the first of which is to go to a SQL Server database and retrieve some rows (i.e. the "extract" part of the overall process).

I want to make the EtlProcess bomb out if there were no rows returned at this stage. How would I go about this? I've taken a stab at overriding OnFinishedProcessing() but I can't see an obvious way to signal that the EtlProcess should bomb out.

What I have so far:

protected override void OnFinishedProcessing(IOperation op)
{
    var sqlExtractionOperation = op as SqlExtractionOperation;
    if (sqlExtractionOperation != null)
    {
        if (sqlExtractionOperation.Statistics.OutputtedRows == 0)
        {
            //TODO: figure out how to make it stop here
        }
    }

    base.OnFinishedProcessing(op);
}
Was it helpful?

Solution

The solution for me was to tell the EtlProcess to execute in single-threaded mode.

By default, each Rhino ETL operation is executed on a separate worker thread, which means any exceptions raised by individual operations are swallowed by default. (The queued worker threads wait in series for each other's data to come through - at least, that is what I got from a quick bit of debugging of the source)

To make an EtlProcess execute in single-threaded mode, just add this to its constructor:

PipelineExecuter = new SingleThreadedPipelineExecuter();

Throwing an exception inside any of the process's operations will then cause the entire process to bomb out. You can record errors at the end of the process by overriding PostProcessing():

protected override void PostProcessing()
{
    base.PostProcessing();

    if (!PipelineExecuter.HasErrors)
        Info("Process completed successfully");
    else
        Warn("Process failed");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top