Each notification application exists within a single instance of Notification Services. An instance is a named entity that groups one or more applications. Multiple instances of Notification Services can run side by side on a single computer, and can be created, started, stopped, managed, and deleted independently.
Instances are defined by an instance configuration file, an XML document that defines the properties of the instance. These properties include the name of the SQL Server that the instance uses, the list of applications in the instance, and information about protocols and delivery channels that applications in the instance can use.
Each application in the instance is defined by an application definition file (ADF). The ADF defines the schema of the various entities in the application (events, subscriptions, and notifications), rules that maintain application state and perform matching, and various execution settings that control the runtime behavior of the application. The instance configuration file contains a link to the ADF for each application listed.
When the instance is created, a Notification Services compiler processes the instance configuration file, and each ADF it refers to, and creates databases. The compiler creates one main database for the instance, and one database for each application. Subscriber data is stored in the instance database and is shared by all applications in that instance. Event, subscription, and notification data for each application is stored separately in each application database.
Each instance is associated with its own Windows Service that can be started and stopped independently. The Windows Service for a particular instance is named NS$<InstanceName>, where <InstanceName> is the name of the instance. For example, the Windows Service in which the functional components of an instance named MyInst01 will run will be called NS$MyInst01.
When the Windows Service for a particular instance is started, it instantiates and runs all the components (event providers, generators, and distributors) for the applications contained in that instance. These interact with the instance and application databases, as described in the previous section.
Just as multiple instances can exist on a single computer, a single instance can span multiple computers. For scale-out purposes, an administrator may wish to run the event collection, generation, and distribution components of an application on separate computers. Though they run on separate computers, these are still considered a single instance from a management point of view. Each computer will run a separate copy of the Windows Service, which will then host only the components configured to run on that computer.
Separate instances can be configured with separate security settings. The Windows Services for each instance can run under separate user accounts, and the databases for each can be configured with different access rights. This is particularly useful when the data in one instance needs to be isolated from the data in another instance.