Giter VIP home page Giter VIP logo

active_jorb's Introduction

ActiveJorb CircleCI

An Active Job compatible queueing interface. This library will allow you to enqueue jobs on your existing Active Job compatible backend. This is particularly useful if you're strangling your existing Rails project to death.

The intention is to fully support any and all backends that Active Job supports. Pull requests are much appreciated.

Installation

def deps do
  [
    {:active_jorb, "~> 0.1.0"}
  ]
end

Supported Backends

Backend Supported? Add to mix.exs Link
Sidekiq Yes {:sidewalk, "~> 0.3.4} https://hex.pm/packages/sidewalk
Resque No (#6)
Que No (#4)
Queue Classic No (#5)
Backburner No (#3)
Sneakers No (#7)

Usage

After installing the dependency for your required backend, it's recommended that you proxy access to the supported queue adapter in your application:

# config/dev.exs
config :my_application, MyApplication,
  job_queue_adapter: ActiveJorb.QueueAdapter.Sidekiq

# config/test.exs
config :my_application, MyApplication,
  job_queue_adapter: ActiveJorb.QueueAdapter.Test

# lib/my_application/job_queue.ex
defmodule MyApplication.JobQueue do
  @queue_adapter Application.get_env(:my_application, :job_queue_adapter)

  defdelegate enqueue(job), to: @queue_adapter
  defdelegate enqueue_at(job), to: @queue_adapter
end

To enqueue a job you must first construct an %ActiveJorb.Job{}, and then pass it to the enqueue method of choice:

iex> job = %ActiveJorb.Job{job_class: "MyJob", arguments: [1, 2, 3]}
iex> MyApplication.JobQueue.enqueue(job)
{:ok, "some-job-id"}

iex> ts = ~N[2019-01-01 12:30:00]
iex> MyApplication.JobQueue.enqueue_at(job, ts)
{:ok, "some-other-job-id"}

Testing

See ActiveJorb.QueueAdapters.Test.

Prior Art, Credit, and Thanks

  • All of the maintainers of Active Job
  • The various authors of any supported backend
  • The various authors of any Elixir library supporting those backends

active_jorb's People

Contributors

jherdman 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.