<commit_before># queue_classic

[![Build Status](https://travis-ci.org/QueueClassic/queue_classic.svg?branch=master)](https://travis-ci.org/QueueClassic/queue_classic)
[![Code Climate](https://codeclimate.com/github/QueueClassic/queue_classic.png)](https://codeclimate.com/github/QueueClassic/queue_classic)

Current: v3.0.X
Older stable: [v2.2.3](https://github.com/QueueClassic/queue_classic/tree/v2.2.3)


queue_classic provides a simple interface to a PostgreSQL-backed message queue. queue_classic specializes in concurrent locking and minimizing database load while providing a simple, intuitive developer experience. queue_classic assumes that you are already using PostgreSQL in your production environment and that adding another dependency (e.g. redis, beanstalkd, 0mq) is undesirable.

Features:

* Leverage of PostgreSQL's listen/notify & row locking.
* Support for multiple queues with heterogeneous workers.
* JSON data format.
* Forking workers.
* Workers can work multiple queues.
* Reduced row contention using a [relaxed FIFO](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/Lock_Free.pdf) technique.

Contents:

* [Documentation](http://rubydoc.info/gems/queue_classic/2.2.3/frames)
* [Usage](#usage)
* [Setup](#setup)
* [Upgrade from V2 to V3](#upgrade-from-v2-to-v3)
* [Configuration](#configuration)
  * [JSON](#json)
  * [Logging](#logging)
* [Support](#support)
* [Hacking](#hacking-on-queue_classic)
* [License](#license)

## Usage

There are 2 ways to use queue_classic.

* Producing Jobs
* Working Jobs

### Producing Jobs

The first argument is a string which represents a ruby object and a method name. The second argument(s) will be passed along as arguments to the method invocation defined by the first argument. The set of arguments will be encoded as JSON in the database.

```ruby
# This method has no arguments.
QC.enqueue("Time.now")
<commit_msg>give some love to README<commit_after># queue_classic

<p align="center">
  <b>Simple, efficient worker queue for Ruby & PostgreSQL</b>
  <br />
  <a href="https://travis-ci.org/QueueClassic/queue_classic"><img src="http://img.shields.io/travis/QueueClassic/queue_classic/master.svg?style=flat" /></a>

  <a href="https://codeclimate.com/github/QueueClassic/queue_classic"><img src="http://img.shields.io/codeclimate/github/QueueClassic/queue_classic.svg?style=flat" /></a>

  <a href="http://badge.fury.io/rb/queue_classic"><img src="http://img.shields.io/gem/v/queue_classic.svg?style=flat" alt="Gem Version" height="18"></a>
</p>


**IMPORTANT NOTE REGARDING VERSIONS**

**This README is representing the current work for queue_classic 3.1, which is neither complete or stable. You can find the README for stable versions:**

- latest stable can be found: [v3.0.X](https://github.com/QueueClassic/queue_classic/tree/3-0-stable)
- older stable: [v2.2.3](https://github.com/QueueClassic/queue_classic/tree/v2.2.3)


## What is queue_classic?

queue_classic provides a simple interface to a PostgreSQL-backed message queue. queue_classic specializes in concurrent locking and minimizing database load while providing a simple, intuitive developer experience. queue_classic assumes that you are already using PostgreSQL in your production environment and that adding another dependency (e.g. redis, beanstalkd, 0mq) is undesirable.

## Features

* Leverage of PostgreSQL's listen/notify & row locking.
* Support for multiple queues with heterogeneous workers.
* JSON data format.
* Forking workers.
* Workers can work multiple queues.
* Reduced row contention using a [relaxed FIFO](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/Lock_Free.pdf) technique.

## Table of content

* [Documentation](http://rubydoc.info/gems/queue_classic/2.2.3/frames)
* [Usage](#usage)
* [Setup](#setup)
* [Upgrade from V2 to V3](#upgrade-from-v2-to-v3)
* [Configuration](#configuration)
  * [JSON](#json)
  * [Logging](#logging)
* [Support](#support)
* [Hacking](#hacking-on-queue_classic)
* [License](#license)

## Usage

There are 2 ways to use queue_classic.

* Producing Jobs
* Working Jobs

### Producing Jobs

The first argument is a string which represents a ruby object and a method name. The second argument(s) will be passed along as arguments to the method invocation defined by the first argument. The set of arguments will be encoded as JSON in the database.

```ruby
# This method has no arguments.
QC.enqueue("Time.now")

{'fraction_non_alphanumeric': 0.12338398729870718, 'fraction_numerical': 0.009072352007257882, 'mean_word_length': 5.082758620689655, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 9, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1707408', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1373, 'n_words': 408}