# Monitor the size of the Import and Index Queues

CFS generates events when the import queue and the outgoing (indexing) queue become full, become empty, or the queue size passes certain thresholds. If a queue approaches its maximum size, this might indicate a problem, or that applications are making requests to Connector Framework Server faster than they can be processed.

CFS generates the following events for each queue that is monitored:

- A `QueueFull` event occurs when the queue becomes full.
- A `QueueFilling` event occurs when the queue size exceeds a configurable threshold (`QueueFillingThreshold`) and the last event was a `QueueEmpty` or `QueueEmptying` event.
- A `QueueEmptying` event occurs when the queue size falls below a configurable threshold (`QueueEmptyingThreshold`) and the last event was a `QueueFull` or `QueueFilling` event.
- A `QueueEmpty` event occurs when the queue becomes empty.

You can configure event handlers to process these events. For example, you might want to notify an administrator if the size of a queue reaches 80 percent of the maximum.

To monitor queue sizes

1. Stop CFS.
2. Open the CFS configuration file in a text editor.

3. Set the `OnQueueEvent` parameter to the name of a section that configures the event handler.

   - To monitor the size of the import queue, set this parameter in the `[ImportService]` section. For example:

         [ImportService]
         OnQueueEvent=MyEventHandler

   - To monitor the size of the outgoing (indexing) queue, set this parameter in the `[Indexing]` section. For example:

         [Indexing]
         OnQueueEvent=MyEventHandler

4. Create a new section in the configuration file to contain the settings for your event handler. You must name the section using the name you specified with the `OnQueueEvent` parameter.

5. In the new section, set the `LibraryName` parameter.

   `LibraryName` | The type of event handler to use to handle the event. To write event data to a text file, set this parameter to `TextFileHandler`, and then set the `FilePath` parameter to specify the path of the file. To send event data to a URL, set this parameter to `HttpHandler`, and then use the HTTP event handler parameters to specify the URL, proxy server settings, credentials, and so on. To run a Lua script, set this parameter to `LuaHandler`, and then use the `LuaScript` parameter to specify the script to run. For information about writing the script, see Write a Lua Script to Handle Events.

   For example:

       [MyEventHandler]
       LibraryName=LuaHandler
       LuaScript=./handle_queue_event.lua

6. Save and close the configuration file. You must restart CFS for your changes to take effect.

_FT_HTML5_bannerTitle.htm