IScheduledEventProvider.Run Method
Activates the event provider to begin collecting events.
네임스페이스: Microsoft.SqlServer.NotificationServices
어셈블리: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
구문
‘선언
Function Run As Boolean
bool Run ()
bool Run ()
boolean Run ()
function Run () : boolean
반환 값
A Boolean value that indicates whether the event provider was able to run successfully.
주의
The provider host calls this method to start the event provider. The method must return true if the scheduled event provider has completed its current schedule interval and is prepared to exit. Otherwise, the method must return false. A false return value disables the event provider and prevents the event provider host from calling the Run method until the event provider is enabled.
When the notification application starts, the provider host calls the Initialize method on the scheduled event provider. The provider host reads the schedule information for this event provider, and then calls the event provider's Run method as indicated by the schedule in the application definition.
The provider host calls Run on every scheduled interval after the call to Initialize returns successfully. A scheduled event provider must return from the Run call within five minutes or before the next scheduled interval, whichever comes first. If you think your event collection routine will take longer than that to complete, you must program the event provider to either use a callback function, or to gather and submit events on one or more separate threads. If you choose to have multiple threads running in parallel and if event order is important to your application, make sure to synchronize the threads so that they submit events to the database in the same order in which they were created.
If the event provider has not returned when the next scheduled interval arrives, the provider host waits until the following interval to call Run again. To avoid missing calls, a scheduled event provider must always return from the Run method call on time. Make sure that you set the schedule of the event provider so that it can complete its tasks and return in a timely fashion.
A scheduled event provider will normally return false from the Run method to let the provider host know something is wrong and that it is not going to continue to run. If the scheduled event provider has already returned from Run and is now submitting events on a separate thread, then it must use the StopHandler delegate to notify the provider host that something has gone wrong. This delegate is passed to the event provider as an argument to the Initialize method, so that the event provider can invoke it if it needs to be terminated.
If exceptions are not handled, the provider host logs the unhandled error and then invokes the Initialize method on the event provider.
예
For an example of how to implement the Run method, see the IScheduledEventProvider topic.
스레드 보안
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
IScheduledEventProvider Interface
IScheduledEventProvider Members
Microsoft.SqlServer.NotificationServices Namespace