1

I'm working on a system which amongst other things, runs payroll, a heavy load process. It is likely that soon, there may be so many requests to run payroll at peak times that the batch servers will be overwhelmed.

I'm looking to put together a proof of concept to cope with this by using MSMQ (probably replacing this with a commercial solution like nservicebus later). I using this this example as a basis. I can see how to set up the bindings and stick it together, but I still need a way to tell the subscribers hosted by WAS to only process the 'run heavy payroll process' message if they are not busy. Otherwise the messages on the queue will get picked up straightaway and we have the same problem as before.

Can I set up the subscribing service to say, "I'm busy, I can't take the message, leave it on the queue"? Does the queue need to be transactional?

Jonny Cundall
  • 2,552
  • 1
  • 21
  • 33

2 Answers2

1

If you're using WCF then there's no way to conditionally activate the channel thereby leaving the messages on the queue for later.

A better solution is to host the message receiver in a completely different process, for example as a windows service. These can then be enabled/disabled according to your service window requirement.

You also get the additional benefit of being able to very easily scale out the message receivers to handle greater loads (by hosting more instances of your receiver).

tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • as I am using WCF, and there are already multiple listeners, this seems to be the right way of doing things, although I also may have the option of adding a bit of logic to the existing BizTalk server to dynamically poll the queue. – Jonny Cundall Dec 12 '12 at 16:31
  • My point is you don't need to host the listeners in WAS/IIS. This is complex at best, and doesn't give you the control which you need. Windows services would be much better suited as you can turn them off during busy periods. – tom redfern Dec 12 '12 at 17:25
0

One way to do this is to have 2 queues, your polling always checks the high priority queue first, only if there are no items in that queue does it take an item from the other

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252
  • I agree that splitting the queues is a good idea but is there any way to tell WCF to favour one queue over the other? – tom redfern Dec 12 '12 at 17:30