Coder Social home page Coder Social logo

cscm-hen's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.