Back: CSharp Reference Implementation

The Direct Monitor Windows Service reads settings from MonitorWinSrv.exe.config.


Config File

All configuration is stored in MonitorWinSrv.exe.config.
  • The MonitorWinSrv.exe.config checked into the source tree (csharp\windows services\monitor.winsrv\app.config) contains sample configuration.
  • When you deploy, you should replace this app.config with one of your own. Note: the Enterprise Installer allows configuration of the connectoinString and testing at deployment time.

Standard Config Sections

Make sure your config file contains the Standard Direct Config Sections and the quartz config section.
<configuration>
  <configSections>
    <section name="logging" type="Health.Direct.Common.Diagnostics.LogFileSection, Health.Direct.Common" />
    <section name="ioc" type="Health.Direct.Common.Container.IocContainerSection, Health.Direct.Common" />
    <section name="container" type="Health.Direct.Common.Container.SimpleContainerSection, Health.Direct.Common" />
    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    ....
  </configSections>
 
   ...
<configuration>

Connect String

/configuration/connectionStrings (Required)

<configuration>
...
    <connectionStrings>
        <add name="configStore" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DirectConfig;Integrated Security=SSPI;"/>

AppSettings

/configuration/appSettings

<configuration>
...
    <appSettings>
       <add key="queryTimeout" value="00:00:10" />
     </appSettings>
...

key
Required
Type
Default
Description
queryTimeout
No
Timespan
00:00:05
5 seconds

Logging

/logging (Required)
You customized logging using the logging section.

<configuration>
...
   <logging>...


Quartz settings


The Monitor Server uses Quartz.NET - Enterprise Job Scheduler for .NET Platform. Make sure you place the following in your config file.

/configuration/quartz (Required)

<configuration>
  ...
 
  <quartz >
    <add key="quartz.scheduler.instanceName" value="Health.Direct.Scheduler" />
 
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="10" />
    <add key="quartz.threadPool.threadPriority" value="Normal" />
 
    <!--<add key="quartz.jobStore.misfireThreshold" value="60000" />-->
    <add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
 
    <add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.JobInitializationPlugin, Quartz" />
    <add key="quartz.plugin.xml.fileNames" value="~/jobs.xml" />
  </quartz>
</configuration>
 

See quartznet for thorough documentation of quartnet. This is version 1 of quartznet
  • quartz.plugin.xml.fileNames set to jobs.xml. This is where the plug in jobs and triggers are defined as described in the next section.


Jobs and Triggers


Monitor Server finds jobs and triggers in jobs.xml.

Jobs and triggers can be added or modified. Each job is triggered by one simple trigger. The list below satisfies the requirements in the Implementation Guid for Delivery Notifications in Direct.

Jobs

  • MdnProcessedTimeout
  • MdnDispatchedTimeout
  • CleanTimeOut
  • CleanDispositions


MdnProcessedTimeout

Find expired processed MDNs, mark expired and send failed DSNs


Job: -- job-data-map configuration points --
  • BulkCount is number of rows to work on each time executed.
  • ExpiredMinutes is number of minutes before an expected dispatched MDN is expected.
  • PickupFolder is the Direct Project pickup folder to loop the DSN back into the network. Note: EnableRelay must be true for InternalMessage in SmtpAgentConfig.xml.

Trigger:
  • repeat-interval. How often the trigger executes the job. Default is 10 seconds.


<quartz>
  <job>
    <job-detail>
      <name>MdnProcessedTimeout</name>
      <group>MdnProcessedGroup</group>
      <description>Create failed DSN's for timed out process MDN's.</description>
      <job-type>Health.Direct.MdnMonitor.MdnProcessedTimeout, Health.Direct.MdnMonitor</job-type>
      <volatile>false</volatile>
      <durable>true</durable>
      <recover>false</recover>
      <job-data-map>
        <entry>
          <key>BulkCount</key>
          <value>100</value>
        </entry>
        <entry>
          <key>ExpiredMinutes</key>
          <value>10</value>
        </entry>
        <entry>
          <key>PickupFolder</key>
          <value>c:\inetpub\mailroot\testPickup</value>
        </entry>
      </job-data-map>
    </job-detail>
 
    <trigger>
      <simple>
        <name>MdnProcessedTimeoutTrigger</name>
        <group>MdnProcessedTimeoutTriggerGroup</group>
        <description>Continuously trigger the MdnProcessedTimeout job.</description>
        <misfire-instruction>SmartPolicy</misfire-instruction>
        <volatile>false</volatile>
        <job-name>MdnProcessedTimeout</job-name>
        <job-group>MdnProcessedGroup</job-group>
        <repeat-count>RepeatIndefinitely</repeat-count>       
        <repeat-interval>10000</repeat-interval><!-- 10 seconds-->
      </simple>
    </trigger>
  </job>
...
</quartz>


MdnDispatchedTimeout

Find expired dispatched MDNs, mark expired and send a failed DSNs

Job: -- job-data-map configuration points --
  • BulkCount is number of rows to work on each time executed.
  • ExpiredMinutes is number of minutes before an expected dispatched MDN is expected.
  • PickupFolder is the Direct Project pickup folder to loop the DSN back into the network. Note: EnableRelay must be true for InternalMessage in SmtpAgentConfig.xml.

Trigger:
  • repeat-interval. How often the trigger executes the job. Default is 10 seconds.


<quartz>
...
  <job>
    <job-detail>
      <name>MdnDispatchedTimeout</name>
      <group>MdnDispatchedGroup</group>
      <description>Create failed mdn's for timed out dispatched mdn's.</description>
      <job-type>Health.Direct.MdnMonitor.MdnDispatchedTimeout, Health.Direct.MdnMonitor</job-type>
      <volatile>false</volatile>
      <durable>true</durable>
      <recover>false</recover>
      <job-data-map>        
        <entry>
          <key>BulkCount</key>
          <value>100</value>
        </entry>
        <entry>
          <key>ExpiredMinutes</key>
          <value>10</value>
        </entry>        
        <entry>
          <key>PickupFolder</key>
          <value>c:\inetpub\mailroot\testPickup</value>
        </entry>
      </job-data-map>
    </job-detail>
 
    <trigger>
      <simple>
        <name>MdnDispatchedTimeoutTrigger</name>
        <group>MdnDispatchedTimeoutTriggerGroup</group>
        <description>Continuously trigger the MdnDispatchedTimeout job.</description>
        <misfire-instruction>SmartPolicy</misfire-instruction>
        <volatile>false</volatile>
        <job-name>MdnDispatchedTimeout</job-name>
        <job-group>MdnDispatchedGroup</job-group>
        <repeat-count>RepeatIndefinitely</repeat-count>
        <repeat-interval>10000</repeat-interval><!-- 10 seconds-->
      </simple>
    </trigger>
  </job>
...
</quartz>

CleanTimeOut

Clean up incomplete MDNs older than configured days.

Job:
Edit days to retain in job-data-map. Default is 1 day.

Trigger:
  • repeat-interval. How often the trigger executes the job. Default is I minute.

<quartz>
...
  <job>
    <job-detail>
      <name>CleanTimeOut</name>
      <group>CleanTimeOutGroup</group>
      <description>Clean up incomplete MDNs</description>
      <job-type>Health.Direct.MdnMonitor.CleanTimeOut, Health.Direct.MdnMonitor</job-type>
      <volatile>false</volatile>
      <durable>true</durable>
      <recover>false</recover>
      <job-data-map>
        <entry>
          <key>Days</key>
          <value>1</value>
        </entry>
      </job-data-map>
    </job-detail>
 
    <trigger>
      <simple>
        <name>CleanTimeOutTrigger</name>
        <group>CleanTimeOuttriggerGroup</group>
        <description>Continuously trigger the CleanTimeOut job.</description>
        <misfire-instruction>SmartPolicy</misfire-instruction>
        <volatile>false</volatile>
        <job-name>CleanTimeOut</job-name>
        <job-group>CleanTimeOutGroup</job-group>
        <repeat-count>RepeatIndefinitely</repeat-count>
        <repeat-interval>60000</repeat-interval><!-- 1 minute-->
      </simple>
    </trigger>
  </job>
...
</quartz>

CleanDispositions

Clean up completed MDNs older than configured days
Completed definition:
  • Processed but delivery confirmation not requested
  • Dispatched


Job:
Edit days to retain in job-data-map. Default is 1 day.

Trigger:
  • repeat-interval. How often the trigger executes the job. Default is I minute.

<quartz>
...
  <job>
    <job-detail>
      <name>CleanDispositions</name>
      <group>CleanDispositionsGroup</group>
      <description>Clean up completed MDNs</description>
      <job-type>Health.Direct.MdnMonitor.CleanDispositions, Health.Direct.MdnMonitor</job-type>
      <volatile>false</volatile>
      <durable>true</durable>
      <recover>false</recover>
      <job-data-map>
        <entry>
          <key>Days</key>
          <value>1</value>
        </entry>
      </job-data-map>
    </job-detail>
 
    <trigger>
      <simple>
        <name>CleanDispositionsTrigger</name>
        <group>CleanDispositionstriggerGroup</group>
        <description>Continuously trigger the CleanDispositions job.</description>
        <misfire-instruction>SmartPolicy</misfire-instruction>
        <volatile>false</volatile>
        <job-name>CleanDispositions</job-name>
        <job-group>CleanDispositionsGroup</job-group>
        <repeat-count>RepeatIndefinitely</repeat-count>
        <repeat-interval>60000</repeat-interval><!-- 1 minute-->
      </simple>
    </trigger>
  </job>
</quartz>