The Inner Drive Extensible Architecture™—the Idea™

Demonstration: Messaging services

Messaging and logging (sending email, keeping track of what's going on to help fix things, etc.) on this Website now uses the Inner Drive Extensible Architecture™—the Idea™. The Idea gives the site exceptional flexibility and control over how and when the site handles communications to you and to the site administrators.

The trick is that we've divided messaging up into three parts:

There is also a well-known singleton Publisher class that has static methods any application can use to send a message with minimal code. For more advanced applications, the Idea™ can easily be modified to use Windows Communication Foundation (WCF) service to send messages asynchronously. All of this, of course, is transparent to the application sending messages.

This division of labor allows a site administrator to configure which packagers handle which kinds of message, which messages get used or ignored, and how to translate system objects (like exceptions) into messages that can be sent transparently.

For example, the basic type of message that a website uses is the WebMessage object. In addition to having the same characteristics as all other messages, it can deal with some extra information that it would likely encounter in a web application: the IP address of the sender, what browser the sender was using, what page sent the message, etc.

The WebMessage object is handled by the WebMessageSink class. This class has its own configuration information that tells it how to re-publish the WebMessage object as any other kind of message object.

Buy a license

If you want to use the IDEA™ in your commercial application, check out our licensing options.

Code samples

Web page

Here's how the code-behind file for the Feedback page sends a feedback message:

private void SendFeedback()
   var senderName = SenderName.Text;
   var senderEmail = SenderEmail.Text;
   var body = Feedback.MessageBody(senderName, senderEmail, SubjectText.Text, MessageText.Text);

   // The ThisSite.AppTitle uniquely identifies the application to the
   // message sinks.
   var webMessage = new WebMessage(

   if (senderEmail.Length > 0)
      webMessage.Source =
         string.Format(CultureInfo.CurrentUICulture, "{0} <{1}>", senderName, senderEmail.ToLower());


Message sink

Inside the message sink, the interesting code looks like this (with tracing and exception handling removed):

protected void PackageItems(
   object obj,
   string severity) 
   if (null == obj) return;

   var wrapper = obj as IWrappedObject;
   var wrappedType = (null == wrapper) ? obj.GetType() : wrapper.BaseObject.GetType();
   var publishList = GetPublishList(wrappedType, severity);

   const string delimiter = " ,;";
   var delimArray = delimiter.ToCharArray();

   // Avoid duplicate packagers--send the message only once to each
   var finalList = new List<string>();
   foreach (var packagerKey in publishList)
      // Allow multiple packagers for each combination of object and severity
      var multiPacks = packagerKey.Split(delimArray);

      foreach (var packer in multiPacks)
         if (!_packagers.ContainsKey(packer) || 

   foreach (var finalPacker in finalList)
      var packager = _packagers[packagerId];
      var message = packager.Accept(obj);
      var publisher = Publisher.Instance;


The configuration file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
      <sink type="InnerDrive.Messages.NtEventLogSink" 
		assembly="InnerDrive.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"/>
      <sink type="InnerDrive.Messages.NullMessageSink" 
		assembly="InnerDrive.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"/>
      <sink type="InnerDrive.Messages.SmtpMessageSink" 
		assembly="InnerDrive.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"/>
         assembly="InnerDrive.Idea.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"
         assembly="InnerDrive.Idea.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"
         assembly="InnerDrive.Idea.Messages, Version=3.1, Culture=neutral, PublicKeyToken=8aa86d564ce6e2e5"
      <!-- Any item not otherwise mapped, use the NullPackager -->
      <item packager="NullPackager" severity="*">*</item>

      <item packager="SmtpPackager,NtLogPackager" severity="ApplicationStart">InnerDrive.Web.WebMessage</item>
      <item packager="SmtpPackager" severity="Feedback">InnerDrive.Idea.Web.WebMessage</item>
      <item packager="SmtpPackager" severity="Trouble">InnerDrive.Idea.Web.WebMessage</item>

This configuration file shows that Feedback, Trouble, and Application Start messages will be emailed to the designated recipients, and Application Start messages will also be logged in the server's NT Application Log. All other messages will be sent to the Null Packager, which accepts all types of objects and does absolutely nothing with them.

More information

For more information, send us some feedback (using these classes) and someone will get right back to you.

Return home.

Copyright ©2018 Inner Drive Technology. Purveyors of fine, hand-crafted computer software. Legal information. Page printed 2018-09-21T06:06:47 UTC.