Monday, March 26, 2012

Pre and PostExecute Event handler called more than once

I have a task configured on the post execute event handler of a package expecting this task to be executed only once after the completion of all the other tasks in the package. But I found the task configured on the post execute event of the package getting executed as many times as the number of tasks in the package + 1 . Is there any workaround for this problem?

Yes,

The reason this happens is that events "bubble-up" from a container to all parent containers and are caught by any eventhandlers that exist on those parent containers.

To stop this behaviour you'll need to create an eventhandler scoped to each task's OnPreExecute & OnPostExecute eventhandlers and set [@.System::Propogate]=FALSE. This will stop the event "bubbling-up".

-Jamie

No comments:

Post a Comment