A resource is not available until it is online. The Cluster service calls your Online entry point to request that a resource instance be brought from an offline (unavailable) state to an online (available) state. Your implementation of Online is thus the first opportunity you have to ensure high availability.
Typically, the tasks required to bring a resource online take a long time to complete (hundreds to thousands of milliseconds). Most Online implementations create a worker thread to perform these tasks asynchronously.
Whether you implement Online synchronously or asynchronously, your online code should perform the following tasks:
To bring a resource online
Required: If the resource is a service
Required: Bring the resource to an operational state. For applications, this might be as simple as calling CreateProcess.
To implement Online
Recommended: For optimal performance, return a value within 300 milliseconds. If you need more time to perform all of the necessary tasks, have Online start a worker thread and return ERROR_IO_PENDING immediately. See Implementing Pending Operations.
Optional: If you want to implement asynchronous failure detection, return a handle to an object that can be signaled—such as a semaphore—as the EventHandle parameter. For more information see Detecting Resource Failure.