= Beanstalk Protocol =

Here is version 1 of the protocol. Still subject to change as we implement it. More info can be found in #547, #541, and #495.

== Producer Command ==

=== put ===

Command line format:

{{{ put \r\n\r\n }}}

Responses:

{{{ INSERTED\r\n }}} {{{ NOT_INSERTED\r\n }}}

== Worker Commands ==

=== reserve ===

{{{ reserve\r\n }}}

There is only one possible response:

{{{ RESERVED \r\n\r\n }}}

This will return a newly-reserved job. If no job is available to be reserved, beanstalkd will wait to send a response until one becomes available.

=== delete a job ===

{{{ delete \r\n }}}

  • "DELETED\r\n"
  • "NOT_FOUND\r\n"

=== release ===

{{{ release \r\n }}}

  • "RELEASED\r\n"
  • "NOT_RELEASED\r\n"
  • "NOT_FOUND\r\n"

=== bury ===

{{{ bury \r\n }}}

  • "BURIED\r\n"
  • "NOT_FOUND\r\n"

== Admin Commands ==

=== peek ===

{{{ peek\r\n }}}

Will return the next job in the list of buried jobs, if any.

  • FOUND \r\n\r\n
  • "NOT_FOUND\r\n"

=== peek (any job) ===

{{{ peek \r\n }}}

Will return the specified job if it exists.

  • FOUND \r\n\r\n
  • "NOT_FOUND\r\n"

=== kick ===

{{{ kick \r\n }}}

  • "KICKED \n\n"

=== stats ===

{{{ stats\r\n }}}

  • OK \r\n followed by a yaml file of stats values:
    • current ready job count
    • current reserved job count
    • current buried job count
    • put command count
    • peek command count
    • reserve command count
    • delete command count
    • release command count
    • bury command count
    • kick command count
    • stats command count
    • timeout count (should be reserve - done - current reserved job count)
    • current connection count
    • current worker count
    • current producer count

=== stats (for a job) ===

{{{ stats \r\n }}}

* OK <bytes>\r\n followed by a yaml file of stats values:
  * job id
  * ready or reserved or buried
  * age
  * time-left (meaningless if job is not in reserved state)
  * timeout count
* "NOT_FOUND\r\n"