<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I didn't use spring amqp api, so I can
not provide you working example. <br>
<br>
I use consuming with small timeout (and there is a cost of time -
small delay,<br>
not an issue in my case, cpu usage and network fingerprints stays
very small). <br>
I was also taking advantage of rabbit's java client prefetching (I
am not sure <br>
if spring implements that). These two combined gave me acceptable
approximation of priorities. <br>
<br>
You could also add to messages own argument (for example
myPriority) and consume all messages<br>
as they are available (or let's say up to 200 messages or sth),
then put them in a priority <br>
queue on your application side. And then process them from the
head of this container (using <br>
dedicated thread). That also may give you acceptable results. <br>
<br>
Note that the state of art is as follows: RabbitMQ is a FIFO
queue, and does not make <br>
use of message priorities today. It could be changed in one of the
future releases, I don't <br>
know when it may be. As consequence of that you should apply some
reasonable workaround <br>
which will be acceptable for you or reconsider your needs (maybe
you don't really need <br>
priorities?) or use something else than RabbitMQ or implement it
by yourself. By the way <br>
AMQP itself says that "Messages with higher priorities MAY be
delivered before those with <br>
lower priorities". Following that messages priority in any
implementation of AMQP may <br>
be not consistent.<br>
<br>
Best regards, <br>
Ernest Staszuk<br>
<br>
<br>
<br>
<br>
<br>
W dniu 2012-07-27 10:50, andy pisze:<br>
</div>
<blockquote cite="mid:033c01cd6bd4$e76f6b10$b64e4130$@gmail.com"
type="cite"><span style="color:#1F497D" lang="EN-US">at as you say
,if we are processing 2st queue message as soon as the 1<sup>st</sup>
queue gets a new message needed to process,how can we switch to
process 1</span><sup><span style="font-family:宋体;color:#1F497D"
lang="EN-US">st</span></sup><span style="color:#1F497D"
lang="EN-US">? It also means that we should check the amount of
messages in the queue in order ,I think it will cost much time
and machine resource.and could you tell me how I could use
spring amqp a</span></blockquote>
<br>
</body>
</html>