开发者

How to get priority of current job?

In beanstalkd

telnet localhost 11300
USING foo
put 0 100 120 5
hello
INSERTED 1

How can I know what is the priority of this job when I reserve 开发者_如何学运维it? And can I release it by making the new priority equals to current priority +100?


Beanstalkd doesn't return the priority with the data - but you could easily add it as metadata in your own message body. for example, with Json as a message wrapper:

{'priority':100,'timestamp':1302642381,'job':'download http://example.com/'}

The next message that will be reserved will be the next available entry from the selected tubes, according to priority and time - subject to any delay that you had requested when you originally sent the message to the queue.

Addition: You can get the priority of a beanstalk job (as well as a number of other pieces of information, such as how many times it has previously been reserved), but it's an additional call - to the stats-job command. Called with the jobId, it returns about a dozen different pieces of information. See the protocol document, and your libraries docs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜