SQLNS Configuration Files
To tie all these things and components together everything must be configured through a pair of XML-based configuration files: the
Instance Configuration file and the
Application Definition file.
To host a SQLNS application you need an instance of SQLNS. An SQLNS instance can host one or more SQLNS applications. The instance also stores subscriber information, which can be shared among all SQLNS applications hosted on an instance. The Instance Configuration File registers each SQLNS application for that instance. Here's an example of an Instance Configuration file.
<?xml version="1.0" encoding="utf-8" ?>
<NotificationServicesInstance xmlns="http://www.microsoft.com/MicrosoftNotificationServices/ConfigurationFileSchema">
<InstanceName>DM</InstanceName>
<SqlServerSystem>
Localhost
</SqlServerSystem>
<Applications>
<Application>
<ApplicationName>
StockPrice
</ApplicationName>
<BaseDirectoryPath>
C:\MyPath
</BaseDirectoryPath>
<ApplicationDefinitionFilePath>
appADF.xml
</ApplicationDefinitionFilePath>
</Application>
</Applications>
<DeliveryChannels>
<DeliveryChannel>
<DeliveryChannelName>
FileChannel
</DeliveryChannelName>
</DeliveryChannel>
</DeliveryChannels>
</NotificationServicesInstance>
Table 2 shows the most important XML elements used in this configuration file.
Table 2. The table shows a description of each main element in an Instance Configuration file.
| XML element
|
Description
|
| InstanceName |
The name of this SQLNS instance. |
| SqlServerSystem |
The name of the SQL Server that hosts the SQLNS instance database. |
| DeliveryChannel |
Describes the several delivery channels supported by this SQLNS instance. |
Within the
<Applications> section, you need an
<Application> section for each application hosted on this instance. Within each
<Application> element, you configure the XML elements shown in Table 3
Table 3. The table shows the XML elements needed within each <Application> element in the Instance Configuration file.
| XML element
|
Description
|
| ApplicationName |
Name of the SQLNS application hosted on this SQLNS instance. |
| BaseDirectoryPath |
Base directory of the SQLNS application. Here are stored all application relevant information like the Application Definition File. |
| ApplicationDefinitionFilePath |
Name and path to the Application Definition File that configures the SQLNS application. |
The Application Definition File
The Application Definition File is more interesting. You use this file to configure the whole SQLNS application structure along with all necessary metadata.
Listing 1 shows a minimal Application Definition File.
As you can see from
Listing 1, the
sample SQLNS application supports only one subscription, named
StockPriceSubscription. This subscription contains only one relevant bit informationthe
StockSymbolstored in a table column, which gives users of the front-end application the capability of entering the stock codes that they're interested in. SQLNS uses this configuration file to create all the tables required for the SQLNS application.. You'll see more about this feature later.
Through the section
<NotificationClass> you can define the structure of the notifications your application generates. That section's empty in
Listing 1, but you'll define it later. Currently the configuration file defines only that you're going to use the XsltFormatter to format the notifications. You use the Generator to generate the notifications and the Distributor to deliver those notifications to registered users. The
<Generator> and
<Distributors> sections define the computers on which those components are running, making it possible to distribute SQLNS application components over several physical computers for scalability.