Coder Social home page Coder Social logo

robfinner / perl-disque Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lovelle/perl-disque

0.0 2.0 0.0 204 KB

Perl client for Disque, an in-memory, distributed job queue

Home Page: http://search.cpan.org/dist/Disque/

License: MIT License

Perl 100.00%

perl-disque's Introduction

perl-disque

Perl client for Disque, an in-memory, distributed job queue

Fast usage:

For those who want to see the things working right now.

Open new terminal and do:

$ perl examples/producer.pl

Open another terminal and do:

$ perl examples/consumer.pl

You will start sawing the new jobs comming at 'consumer' terminal. Also you can setup multiple instances of disque cluster and shutdown some of them and you will see how the clients will automatic reconnect to any available disque server.

Usage

Connection:

perl-disque will try to connect to any available server in the order is have been set, if there is any disque instance available, the client will generate a connection error and will abort.

if you not spicify any server in conection new() by default will only connect to '127.0.0.1:7711'.

use Disque;
my $disque = Disque->new();

To send new job just do

$disque->add_job('test','job_1', 0);

Documentation

You can use this library with single or multi-node clusters.

Connection:

When you invoke "new()" you can choose in which method you will connect to the cluster, of course, this only will happen if ther is more than 1 node spicified.

By default, as Salvatore specified in the doc, the lib will try to connect to any available server in a randomly way.

But also if you won't to connect to the server randomly you can specify the param "disable_random_connect => 1" in new() sub, for example:

my $disque = Disque->new(
	servers => ['localhost:7711', 'localhost:7712', 'localhost:7713'],
	disable_random_connect => 1
);

So you will connect into the cluster in the order that you have set the nodes.

Debugging:

You can set global environment variable: $ export DISQUE_DEBUG=1

Or you can specify debug at connection:

my $disque = Disque->new(debug => 1);

Status

The commands that are allready available are: add_job get_job ack_job fast_ack qlen qpeek enqueue dequeue del_job show jscan qstat qscan

Installation

$ cpan install Disque

TODO

  • Create tests
  • Add more documentation in pm module

License

See LICENSE.

Thanks

  • Big thanks to Salvatore Sanfilippo aka antirez for share his work.
  • The people who contributed and did perl-redis module.

perl-disque's People

Contributors

lovelle avatar

Watchers

James Cloos avatar Rob Finneran avatar

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.