2

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?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Lina
  • 2,090
  • 4
  • 20
  • 23

1 Answers1

1

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.

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
  • ok but how can i release the job with less priority than current one? ie. self::priority +100 for example??? is it possible to modify the contents of job before releasing it?? – Lina Apr 13 '11 at 05:58
  • No. It returns in priority/time order, from the tubes you are watching. – Alister Bulman May 08 '11 at 22:41