473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Queue-Monitoring Agent

I am trying to develop a queue-monitoring agent. The queue will be either
MSMQ or Amazon's SQS. The message will contain instructions on how a worker
should process (could be lengthy) a file (could be large). The agent's
timing mechanism is disabled until all messages are processed. Currently,
this worker processes messages synchronously. I would like to use a pool of
worker to process the messages asynchronously. The challenge, I am finding,
is how to wait for the pool's next free worker. I've included the
pseduo-code for review. Any thoughts on the pattern would be appreciated.
Thanks,

Craig Buchanan

<SINGLE WORKER>

Sub Timer_Elapsed

disable timer

'drain the queue
while queue has messages

get next message from the queue

process the message synchronously

loop

enable timer

End Sub

</SINGLE WORKER>

<POOL OF WORKERS>

Sub Timer_Elapsed

disable timer

'drain the queue
wait for the next free worker from pool

get the next message from the queue

process the message asynchronously, on another thread

loop

enable timer

End Sub

Sub Processed As IAsyncResult

return the worker to the pool

End Sub

</POOL OF WORKERS>
Oct 16 '08 #1
1 1266
Found a good option:
http://vasters.com/clemensv/default,...004-12-11.aspx

"Craig Buchanan" <re***@newsgroup.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
I am trying to develop a queue-monitoring agent. The queue will be either
MSMQ or Amazon's SQS. The message will contain instructions on how a
worker should process (could be lengthy) a file (could be large). The
agent's timing mechanism is disabled until all messages are processed.
Currently, this worker processes messages synchronously. I would like to
use a pool of worker to process the messages asynchronously. The
challenge, I am finding, is how to wait for the pool's next free worker.
I've included the pseduo-code for review. Any thoughts on the pattern
would be appreciated.
Thanks,

Craig Buchanan

<SINGLE WORKER>

Sub Timer_Elapsed

disable timer

'drain the queue
while queue has messages

get next message from the queue

process the message synchronously

loop

enable timer

End Sub

</SINGLE WORKER>

<POOL OF WORKERS>

Sub Timer_Elapsed

disable timer

'drain the queue
wait for the next free worker from pool

get the next message from the queue

process the message asynchronously, on another thread

loop

enable timer

End Sub

Sub Processed As IAsyncResult

return the worker to the pool

End Sub

</POOL OF WORKERS>


Oct 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place,...
16
by: newsock | last post by:
What differences between queue, deque and priority_queue? And under what situations choose one of them to use? Thanks for your help!
9
by: Brian Henry | last post by:
If i inherite a queue class into my class, and do an override of the enqueue member, how would i then go about actually doing an enqueue of an item? I am a little confused on this one... does over...
3
by: Kceiw | last post by:
Dear all, When I use #include "queue.h", I can't link it. The error message follows: Linking... G:\Projects\Datastructure\Queue\Debug\main.o(.text+0x136): In function `main':...
5
Rooro
by: Rooro | last post by:
Hello everyone i'm working on : " Familiar childhood games such as hide and Go Seek and Tag involve determining the player who is to be "It". One method has the players stand in a circle...
2
by: lavender | last post by:
When define a maxQueue is 10, means it able to store 10 items in circular queue,but when I key in the 10 items, it show "Queue Full" in items number 10. Where is the wrong in my code? Why it cannot...
3
by: jrpfinch | last post by:
I have a script which is based on the following code. Unfortunately, it only works on Python 2.3 and not 2.5 because there is no esema or fsema attribute in the 2.5 Queue. I am hunting through...
4
by: j_depp_99 | last post by:
Thanks to those guys who helped me out yesterday. I have one more problem; my print function for the queue program doesnt work and goes into an endless loop. Also I am unable to calculate the...
2
by: ecestd | last post by:
how do you implement a copy constructor for this pointer-based ADT queue #include <cassert // for assert #include <new // for bad_alloc using namespace std; //private:{Queue::Queue(const...
0
by: ecestd | last post by:
I did implement the copy constructor but still have a problem with it. It is not working. What could be wrong? #include "QueueP.h" #include <cassert // for assert #include <new // for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.