Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nacmartin/edisque
Disque client for Erlang
https://github.com/nacmartin/edisque
Last synced: 6 days ago
JSON representation
Disque client for Erlang
- Host: GitHub
- URL: https://github.com/nacmartin/edisque
- Owner: nacmartin
- License: mit
- Created: 2015-04-29T14:39:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-30T14:45:46.000Z (over 9 years ago)
- Last Synced: 2024-10-30T02:43:41.460Z (about 2 months ago)
- Language: Erlang
- Size: 148 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# edisque
Erlang Disque client. Disque is an in-memory, distributed job queue.
## Example
Example:
git clone git://github.com/nacmartin/edisque.git
cd edisque
make
erl -pa ebin/ deps/**/ebin/
{ok, C} = edisque:start_link().
edisque:add_job(C, <<"queue">>, <<"body">>, 0).
{ok, Resp} = edisque:get_job(C, [<<"queue">>]).
JobId = lists:nth(2, lists:nth(1, Resp)).
edisque:ack_job(C, [JobId]).## Host cycling
Every time edisque runs `GETJOB`, edisque updates statistics of the Disque nodes that are producing the jobs that edisque is consuming. When a number of jobs is consumed (default is 1000), it will check the statistics to see if it can connect to a better node, and will do so if possible.
For more information about this behaviour, check the [Disque](https://github.com/antirez/disque) documentation.
To configure the number of jobs consumed in a cycle, start edisque with `edisque:start_link(Hosts, Cycle)`, where Hosts is a list of tuples of the form `{IP, Port}` as in `{"127.0.0.1", 7711}`, and `Cycle` is the number of jobs consumed before looking for a better client.
If `Cycle` is 0, this feature is disabled.
## Running tests
To run the tests run `make eunit`.
In order to test cycling, it is expected to have two edisque nodes running in a cluster listening to `127.0.01:7711` and `127.0.0.1:7712`.
## Dependencies
Edisque uses [eredis](https://github.com/wooga/eredis) as base Redis client.