MSMQ Trigger

  • Thread starter Thread starter jms
  • Start date Start date
J

jms

Hi,
I am developing a C# application (Framework ver 3.0) using MSMQ Queues
(target windows 2003 server). To quickly summarize, the application first
checks for the presence of a specific private queue and will create it if it
doesn't exist. If it exists, it will write the information to the queue. What
I need to do programatically is set a trigger and rule to run an EXE to
manage the created QUEUE. Since we don't know all the queues at design time
and also want to eliminate setup issues if we did ,manual queue trigger setup
is not an option.

I haven't been able to find any guidance or examples on the web for doing
this, can someone point me in the right direction.



Regards,



Jim
 
You might want to consider WCF and "IsOneWay" messages.....instead of
straight msmq these days.
Esp if you're at 3.0 now.

A couple of in general things.

The userAccount you're running has to have permissions to create
queues...set permissions and such.
Don't ignore this factor.

Test against a remote queue from the start, if that's your end goal. You'll
save alot of heartache.
If your deployment is remote queues...and your development environment is
local...you'll hit snags.

..........

I would also recommend the IDesign helper libraries. (idesign.net) Juval
already has "Create this Queue if WCF is trying to use it , and it doesn't
exist.
Obviously, his code cannot get past a lack of permissions.

The "trigger/exe" thing is something you'll have to work out.

Talking from alot of personal experience, the wcf/isoneway road has been
alot easier than the straight up msmq road of years past.

...

Go to and download and **try out** this example.
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!158.entry
Simple, but it has the IsOneWay, and references to Juvals/IDesign code.
 
Hey Sloan thanks for the reply. I really didn't do a very good job of
explaining my intended design. I will have a web server that will make calls
to N-Number of application servers using WCF. When the WCF component on the
server gets the request, it will see the request is for say Clinical Trial
ABC. The WCF Componet will then check to see if there is a private Queue for
Clinical Trial ABC. If not, it will create the queue (this will only happen
when a new trial goes online), I want to then associate a trigger to the
Queue to invoke a queue manager Exe. Any additional requests for trial ABC
will be written to the created queue. The Queue manager will manage the items
that come into its Queue. I know your first reaction will be OMFG he is
single threading by queue. It is an absolute business need. One Queue per
trial and new trials may come online at anytime so the need to create a
private queue if it is not there and assign the trigger. I have no problem
creating the queue, it is assigning the trigger programatically that I can
not find anything on.
 
Ok, I understand your business need.

1 Queue Per Trial.

...

I don't know what to do.

Here is an idea...talking out of my butt maybe.


<behaviors>

<serviceBehaviors>

<behavior name="DefaultThrottlingBehavior">

<serviceThrottling maxConcurrentCalls="2"

maxConcurrentSessions="10"

maxConcurrentInstances="15" />

</behavior>

</serviceBehaviors>

</behaviors>



That' allows you to control the threads I think. "2" being the setting.



Because you can "code up" anything that is available in WCF and esp the
client/host config files....

Maybe you can code up the service hosts.......per project.



This is the IDesign Code for a config file

//ServiceModelEx.ServiceHost<ZebraAsyncControllerFascade> hostAsync = new
ServiceModelEx.ServiceHost<ZebraAsyncControllerFascade>();

//hostAsync.Open();

Maybe you can code up one of these PER TRIAL...and use the service behavior
(above) to your advantage.



Sorry, that's about as best I can do.



I'd get Juval's book though, on Programming WCF services.

If its possible, its in that book.
 
Back
Top