I wrote a custom destination component. Everything works fine, except there is a logging message that is displayed that I cannot get rid of or correct. Here is the end of the output of a package containing my component:
Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
Information: 0x0 at Data Flow Task, MyDestination: Inserted 40315 rows into C:\temp\file.txt
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "MyDestination" (9)" wrote 0 rows.
SSIS package "Package.dtsx" finished: Success.
I inserted a custom information message that contains the correct number of rows written by the component. I would like to either get rid of the last message "... wrote 0 rows", or figure out what to set to put the correct number of rows into that message.
This message seems to happen in the Cleanup phase. It appears whether I override the Cleanup method of the Pipeline component and do nothing, or not. Any ideas?
public override void Cleanup()
{
ComponentMetaData.FireInformation(0, ComponentMetaData.Name,
"Inserted " + m_rowCount.ToString() + " rows into " + m_fileName,
"", 0, ref m_cancel);
base.Cleanup(); // or not
}
This message comes from the engine and you can not stop it from occuring. To set it correctly you need to call the IncrementPipelinePerfCounters(counter, difference) method on the IDTSComponentMetaData90 interface.
The counter values are:
RowsRead: 101
RowsWritten: 103
BlobBytesRead: 116
BlobBytesWritten: 118
The difference value is the amount to increment the counter by.
Thanks,
Matt
|||Thanks. That did the trick.
Apparently there are constants defined for the counter types, but I'm not sure where they are.
Here's the official help page:
http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.pipeline.wrapper.idtscomponentmetadata90.incrementpipelineperfcounter.aspx
|||The constants for the counter types are listed in the Remarks section of the BOL page for which you pasted the link. Are those not what you were looking for?
-Doug
|||Those constants work. I was hoping to be able to access the constants by an actual constant, instead of having to hard-code the number.
I would rather have code that looks like this:
ComponentMetaData.IncrementPipelinePerfCounter(DTS_PIPELINE_ROWS_WRITTEN, m_rowCount);
than this:
ComponentMetaData.IncrementPipelinePerfCounter(103, m_rowCount);
For now I just created a local constant with the above name and that works fine.
private const uint DTS_PIPELINE_ROWS_WRITTEN = 103;
Maybe those constants are exposed somewhere, but I could not figure out where.
|||Excuse me for missing the point.
I suspect that these counter constants are defined in the native pipeline engine and not exposed in any of the managed classes...that would explain why this managed method expects an integer value and not an enum value. You could create your own enumeration for this purpose.
-Doug
No comments:
Post a Comment