14 Mar 2006

SSIS Creating Synchronous Transform Component

Do you need to write a custom component to transform input data, and disregard this input data, instead, replacing it?
That's was what I needed to accomplish with my component. It takes data from the input buffer and performs a lookup via an external API. If there is a match, send the result data down a "match" output otherwise send the input data down a "unmatch" output. The key here is that the "shape" of the output was changing. In other words, the metadata of the output was very different from that of the input.I also want my component to be synchronous (meaning synchronous, I mean that the component takes a row, processes it and then immediately sends it down an output) and not asynchronous (meaning that it reads all the data and then processes the data in an internal buffer). Now from what I was reading and seeing this was what I thought SSIS meant by synchronous and asynchronous components, but I was wrong!
  1. An asynchronous component can eitherRead all the data in the buffer and cache it. Then after reading all the records process them and then send the data out or
  2. It can read a row of the input; process that data in place without caching it and then send it down the output.
So, I wrote my component to be an asynchronous component but behave like a synchronous component. To do this I create my component outputs setting one to be a synchronous by setting SynchronousInputID of the "unmatch" output to equal the InputId of the input, and for the "matched" output setting InputId=0. The PrimeOutput() method simply needs to assign the output buffer to a private variable. Then, in ProcessInput(), read the row, process it using the external API, and then add the row straight into the output buffer. If you would like to see more, here is the post that I placed on the forum that helped to solve my probelm http://forums.microsoft.com/MSDN/showpost.aspx?postid=295247&siteid=1&message_id=138175&notification_id=138175

No comments: