CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

Creating a Plugin Architecture for WSMQ and Dynamic AppDomains in ASP.NET

I’m finally done with the code for WSMQ Beta 2!  Whew!  If you’re not familiar with WSMQ, it’s a simple, open queue application with a WSE 2.0 endpoint that is easy to manage, deploy and scale. This latest versoin represents a huge refactoring effort from the Beta 1 version.  I’ve also added a bunch of new features. 

Providers within Providers

One that I hope will allow it to be more useful is pluggable data and queue providers.  If you wish to customize the handling of the queue operations, you can simply create a new QueueProvider, drop into the application’s bin directory, configure it and the Queue Web Service and Web Manager will use your new provider.  I’m going to release the source with two queue providers, one for Xml (XmlQueueProvider) and one for Relational Databases (DbQueueProvider).  The DbProvider also uses an additional provider model that will allow you to plugin db-specific data providers (Oracle versus SQL).  The SQL Server provider will also be made available.  I’m not expecting most to develop their own Queue or Data providers, but for those who need to do this, I think this new design will work well.

Message Trigger Plugins

The other,  more generally useful  new features I’ve added are pluggable “Message Triggers” that you can upload to a queue, through the WSMQ web manager.   These triggers allow you to embed custom code into a queue to handle certain queue events, such as messages arriving on a queue or being recieved.

I ran into a host of issues with trying to design a good plugin architecture.  My final design involves spinning up a new AppDomain for the message triggers, so that they can be easily loaded and unloaded when a new trigger is uploaded, deleted or re-versioned.  I found a bunch of great resources on how to do this, so I thought I’d post them here:

Eric Gunnerson’s  AppDomains and Dynamic Loading  is the place to start, as far as I can tell. Great overview and downloadable project.

CodeBetter’s good friend Roy Osherove has a similar, but easier to swallow version of Eric’s example in his series on adding plugins to your app.  Add Plugins to Your App 2: Search dynamically for plugins without Config Files

And Suzanne Cook's .NET CLR Loader Notes are just awesome.  Subscribed!

I’m hoping to have the installer, and source code available for downloading early next week. I’ll try to blog a bit about what I went through to get dynamic AppDomain loading to work with ASP.NET, where things are a little different from standard executables.

-Brendan


Published Sep 09 2005, 02:35 PM by Brendan Tompkins
Filed under:

Comments

Brendan Tompkins said:

Css -

Thanks for the article! I'm implementing my own caching scheme for the members, and I'm definitely going to change some things based on the article.

Brendan
# September 9, 2005 10:19 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Brendan Tompkins

Brendan has been programming with .NET since the first public beta and is owner and operator of Port Technology Services, a consultancy company providing .NET application development services to the Maritime industry. In July, 2007, he was awarded the Microsoft MVP award for ASP.NET. He's also a proud co-founder of failed .COM startup Intrinsigo, and has had a hand in the failure of numerous other businesses. He currently runs CodeBetter.Com and Devlicio.us, and lives in Norfolk, Virgina with his wife Tiara and son Ian.

View Brendan's profile on LinkedIn

Check out Devlicio.us!

Our Sponsors