<br><div class="gmail_quote">On Wed, Oct 7, 2009 at 4:02 PM, Alexis Richardson <span dir="ltr"><<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Bryan<br>
<br>
I assume each job should be completed at most once.<br></blockquote><div><br>Ideally, yes.� Don't want to run 2-3 hour jobs more than necessary. :)<br>�</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You can achieve something almost like what you want by creating two<br>
queues. �Use one for "paying" and one for "non-paying" jobs by binding<br>
each queue to the (direct) exchange using the keys "paying" and<br>
"nonpaying" respectively. �Assign N servers to the "paying" queue.<br>
Let the remainder consume from both queues using some selection scheme<br>
(eg worker randomly chooses a queue each time a new job is needed).<br></blockquote><div><br>I was thinking along those lines, but wanted to make sure I wasn't missing something obvious.� That will require some coding on our end that I was hoping to avoid.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Many other schemes are possible. �However trying to achieve some total<br>
order (eg 'first come first serve') may be more complex than you<br>
really need.<br>
<br>
alexis<br>
<div><div></div><br></div></blockquote><div><br>Total order isn't necessary, we just want to make a good faith effort to serve those who's requests came first.<br><br>I have a related question... BasicConsume has a "filter" parameter.� It's been a few months since I read the AMQP spec.� I took a quick look online, but couldn't find any good documentation.� What does that do (if anything) and how do you use it?� <br>
<br>Ideally, what I was originally fishing for was something like this:<br><br>Client:<br>� headers["paying"] = "true";<br>� bus.Send(message, headers);<br><br>Server A:<br>� bus.Receive(queue="jobs", filter="paying == 'true'");<br>
<br>Server B:<br>� bus.Receive(queue="jobs" /* no filter */);<br><br>Thanks,<br>Bryan<br></div></div>