• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1513
  • Last Modified:

Creating MSMQ Triggers

I am working with message queues and having a hard time wrapping my head around msmq triggers.  I want the receiving portion to be called for each message I send to the queue, processing time is about 1 second per message.  Which would be a better solution, a COM component or stand alone exe??  Whats the difference in the two approaches?
0
jhoop2002
Asked:
jhoop2002
  • 5
  • 4
1 Solution
 
surajgupthaCommented:
Can you give us "more" details about what you intend to achieve by using thse MSMQ triggers?
0
 
jhoop2002Author Commented:
Ok, let me try again.  Each and every time I submit a message to a queue I want something to happen.  From my understanding a trigger can call a COM component or .NET executable.  So if I submit 10 messages then a trigger gets fired 10 times, if I submit 100 messages the trigger gets fired 100 times.  

(from here when I say program I mean COM component or .NET executable)
The program that gets called will then process these messages.  I do not want to have the trigger wait for the program to finish processing the previous message before beginning to process the next.  I want the trigger to call another instance of the program (so I could have multiple instances of the program processing different messages).
0
 
surajgupthaCommented:
I would suggest you using a listenning application/ service instead of using the MSMQ triggers. Merely openning 100 instances for 100 messages may not be the right thing to do if your CPU had the power only to handle 4 messages. I would suggest the user of a listenner that would keep polling the queue for new messages.

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
jhoop2002Author Commented:
well I was sorta hoping that I could have more than one message be processed at the same time.  As I understand the listener service it would only be able to process message 1 - wait - 2 - wait - 3 - wait
0
 
surajgupthaCommented:
well if you used like a windows service to pool the message using .net 3.0 for example you would be able to use object pooling that will control the number of messages to pick at a time. If you set it at 4, 4 messages will be picked up and processed in parallel by 4 instances of the service.
0
 
jhoop2002Author Commented:
wow, do you have any links or do I just google object pooling?
0
 
surajgupthaCommented:
Well if you just used a MSMQ listenner through .net 3.0 (WCF) you dont actually have to control the number of instances, the framework would pick as many messages as it can process.
Here is a link that will help you with setting up a MSMQ listenner using .net 3.0
http://msdn2.microsoft.com/en-us/library/ms752217.aspx

If you still wanted to do object pooling. Here is the info
http://msdn2.microsoft.com/en-us/library/ms751482.aspx
0
 
jhoop2002Author Commented:
ok, can this listener also be accomplished with .net 2.0 with the same results??
0
 
surajgupthaCommented:
An article to read messages from MSMQ using .net 2.0
http://www.codeproject.com/csharp/mgpmyqueue.asp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now