Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I've got an interesting question/statement about event handlers:
Tasks fire the same EH at the same time. My understanding is all EHs fire at the same time (Parallel).
If I understand the question correctly, the package has an event handler that can handle multiple events, and these events fire at about the same time. What happens?
Well, I did not work much with event handlers, so let's experiment and test how it works. This is really simple. I've create a package with two dummy script tasks A and B (not connected with any precedence constraints) that fail (by returning failure) and OnError event handler on the Package. The event handler contains a simple script task that prints the name of the event source:
MsgBox(Dts.Variables(
"SourceName").Value, MsgBoxStyle.Information, "Event Handler")
What will be the result of executing this? Will we get two message boxes at the same time, or sequentially two message boxes?
The answer is - two message boxes popup sequentially one after another, but never at the same time. Ssometimes A is the first, sometimes B. The event handler (like any other task) is not reentrable and only a single instance of an event handler can be running at a time, thus the second event has to wait for the event handler to finish processing the first event before processing the next one.