Microsoft Message Queue Trigger with VB.NET
Last week, including the weekend and today, I’ve been working with (or as I prefer, TRYING to work with) Message Queues and .NET.
The scenario is this. I have different web applications and needed a way for them to communicate with each other “backstage”, so I thought about Microsoft Message Queues.
I didn’t want to write a service to monitor the queue, because that’s something that’s provided by the MSMQ service itself so it makes no sense to replicate such functionality. After much trial and error and hitting the computer desk, and complaining about the lack of information about this on the Internet, I finally made my triggers work. Here is a small tutorial for anyone that wants to do this (and also for when I forget how the heck I did it).
Create the .NET Assembly
Create a COM Class
Sign the assembly with a strong key
Register the assembly in the Global Assembly Cache (GAC)
Register the trigger rule
Register the Trigger
Test the thing!!!!
The first step was to create a .NET assembly. This assembly needs three special things.
It needs to have a COM CLASS
It needs to have ‘Register for COM Interop” checked in the Configuration Build dialog.
It needs to have a strong name (signed with a key)
So, create a new Class Library project, add a COM Class and code your class.
Create a key with the sn.exe utility (from the Visual Studio Command Prompt) with the –k option to generate a new key and specify the key name. After doing this, place the .snk file in the project folder, and add the following to the AssemblyInfo.vb in your Class Library.
<Assembly: AssemblyDelaySign(False)>
<Assembly: AssemblyKeyName("")>
<Assembly: AssemblyKeyFile("..\..\\yourkeyfilename.snk")>
Compile your class, and use the following to register in the Global Assembly Cache:
regasm dllname.dll
gacutil /if dllname.dll
To unregister this class from the GAC (If you need to), use the following syntax::
regasm -u dllname.dll
gacutil -uf dllname
After doing this, your class library is visible to COM clients (you can test this by calling your component from traditional ASP or VB 6).
When you create the MSMQ Trigger, keep in mind that in Windows 2000 the only action for a message is Peeking, so you’ll have to delete the message from the queue manually in your code. In Windows 2003 and XP you can specify a “Retrieval’ action, so the trigger automatically deletes the message.
Register the class and method name in the trigger definition dialog and test!!
Monday, December 20, 2004
Saturday, September 04, 2004
Review of Creative's new Zen Portable Media Center - Engadget - www.engadget.com
The portable media centers are out!
This is a great review of the Creative Zen. I think these devices are great, I would really like yo buy one, but let's get serious here, I'm really thinking about paying $500 for a device that ONLY plays music/videos and photos.
I say ONLY, because with the same amount of money I could get a high-end Pocket PC and play video/audio/pictures with it. Of course, I wouldn't get the 20GB storage, but I could do fine with 1GB Compact Flash (just around $100 now) for basic stuff.
Another good (and long) review is from this guy, Corey Gouker, a Microsoft MVP fro Media Center Pcs.
http://blogs.coreygouker.com/PermaLink.aspx?guid=64fabf6f-8bac-4f2b-90c1-98e162520182
I'm still wating for the second part of the review.
The portable media centers are out!
This is a great review of the Creative Zen. I think these devices are great, I would really like yo buy one, but let's get serious here, I'm really thinking about paying $500 for a device that ONLY plays music/videos and photos.
I say ONLY, because with the same amount of money I could get a high-end Pocket PC and play video/audio/pictures with it. Of course, I wouldn't get the 20GB storage, but I could do fine with 1GB Compact Flash (just around $100 now) for basic stuff.
Another good (and long) review is from this guy, Corey Gouker, a Microsoft MVP fro Media Center Pcs.
http://blogs.coreygouker.com/PermaLink.aspx?guid=64fabf6f-8bac-4f2b-90c1-98e162520182
I'm still wating for the second part of the review.
Friday, August 27, 2004
Tibia!!
A friend of mine told me about a free MMORPG called Tibia. You can sign up at http://www.tibia.com
The graphics look like Ultima Online Style. It's supposed to be very addictive. I signed up, but haven't played yet. Try it out.
A friend of mine told me about a free MMORPG called Tibia. You can sign up at http://www.tibia.com
The graphics look like Ultima Online Style. It's supposed to be very addictive. I signed up, but haven't played yet. Try it out.
Tuesday, July 27, 2004
Start spreading the news, I’m leaving today
I want to be a part of it - new york, new york
These vagabond shoes, are longing to stray
Right through the very heart of it - new york, new york
Ttoday was my last day on my current job
I'M THRILLED!!!!
But then again, i'm gonna miss my co-workers, but THEN AGAIN, the move is for the better.
I'm going to a new company with a different but somehow similar job description. (I just hope I don't get waken up at 2:00 am anymore :)
So goodbye to www.elcaribecdn.com.
I want to be a part of it - new york, new york
These vagabond shoes, are longing to stray
Right through the very heart of it - new york, new york
Ttoday was my last day on my current job
I'M THRILLED!!!!
But then again, i'm gonna miss my co-workers, but THEN AGAIN, the move is for the better.
I'm going to a new company with a different but somehow similar job description. (I just hope I don't get waken up at 2:00 am anymore :)
So goodbye to www.elcaribecdn.com.
Thursday, May 13, 2004
I've recently begun to appreciate the joys of RSS Feeds.
I was sitting at work last week, and started up SharpReader RSS, the only reason I had it on my PC was because I was writing some RSS feeds for the newspaper portal I work for.
I was kind of bored (yeah, I know, I was at work, I was supposed to be *working*.
So anyway, I started browsing the internet and adding every rss feed I saw to SharpReader.
The next day, I was bored again :) so I clicked on SharpReader, and started to read some headlines. The headlines lead to reading the text, and before I knew it, I was reading every programmer's blog I saw.
The thing is that reading those blogs, made me want to start writing my own!
I had created this blog almost a month ago, but never sat down to write something in (at, on) it!
OH, I forgot, If you see some misspelling or something strange in my writing, you really can't blame me, since english is my second language. I'm from the Dominican Republic, the country of el merengue, el sancocho y el mangĂș (more info on those later).
I was sitting at work last week, and started up SharpReader RSS, the only reason I had it on my PC was because I was writing some RSS feeds for the newspaper portal I work for.
I was kind of bored (yeah, I know, I was at work, I was supposed to be *working*.
So anyway, I started browsing the internet and adding every rss feed I saw to SharpReader.
The next day, I was bored again :) so I clicked on SharpReader, and started to read some headlines. The headlines lead to reading the text, and before I knew it, I was reading every programmer's blog I saw.
The thing is that reading those blogs, made me want to start writing my own!
I had created this blog almost a month ago, but never sat down to write something in (at, on) it!
OH, I forgot, If you see some misspelling or something strange in my writing, you really can't blame me, since english is my second language. I'm from the Dominican Republic, the country of el merengue, el sancocho y el mangĂș (more info on those later).
Subscribe to:
Posts (Atom)