Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
beanstalk client for Chicken Scheme
Scheme
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc adding beanstalk protocol reference document
tests slightly better test for hen-reserve
.gitignore adding build artifacts to .gitignore
README.org updating README
gpl-3.0.txt adding GPL 3 license
hen.meta adding missing dependency to regex
hen.scm need to account for extra two bytes \r\n when reading response with r…
hen.setup
hen.utils.scm utility to trim the last whitespace character of a string if any, nee…

README.org

hen — a beanstalk client

beanstalk is a protocol for interfacing with beanstalkd, a “simple, fast work queue.”

hen is a simple client for workers and producers

Examples

Worker

(with-hen (tcp-connect "localhost" 11300)
  (while #t         
    (hen-ignore "default")
    (hen-watch "my-tube")
    (let ([job (hen-reserve)]) ; blocks, optional timeout parameter
      (my-process-job job)
      (hen-delete ((compose cdr assoc) 'id job)))))

Producer

(with-hen (tcp-connect "localhost" 11300)
  (hen-use "my-tube")
  (hen-put "hello worker!"))

Procedures

The following are supported beanstalk commands:

(hen-put [PRI 2^31 [DELAY 0 [TTR 36000]]] data)
(hen-reserve [TIMEOUT #f])
(hen-use TUBE)
(hen-delete ID)
(hen-release ID [PRI 2^31 [DELAY 0]])
(hen-bury ID [PRI 2^31])
(hen-touch ID)
(hen-watch TUBE)
(hen-ignore TUBE)
(hen-peek ID)
(hen-peek-ready)
(hen-peek-delayed)
(hen-peek-buried)
(hen-kick bound)
(hen-stats-job ID)
(hen-stats-tube TUBE)
(hen-stats)
(hen-list-tubes)
(hen-list-tube-used)
(hen-list-tubes-watched)
(hen-quit)
(hen-pause-tube TUBE DELAY)

Most of the commands will return a simple string status. Exceptions are the stats commands, which return an alist, and the reserve command, which returns a pair (job-id . data) if a job is reserved.

All hen commands also accept keyword arguments #:tcp-in and #:tcp-out to override hen-in and hen-out, which are the default ports, initially unspecified.

Notes

  • The structure of return values is subject to change.
Something went wrong with that request. Please try again.