Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.
/ q Public archive

Q is a simple, JSON-based, Redis-backed message queue system for Elixir.

Notifications You must be signed in to change notification settings

mewna/q

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Q

Q is a simple, JSON-based, Redis-backed message queue system, for when ex. it doesn't make sense to have your nodes join a cluster together.

Queued elements are automatically encoded into JSON; if you pass a binary, Q assumes that it's already valid JSON and will not attempt to validate it for you.

Configuration

%{
  # Must be passed. Used for naming the process
  name: :"queue-name",
  # Should be the same between all workers
  queue: "redis queue name",
  # Connecting to redis
  host: "localhost",
  port: 6379,
  pass: "a",
  # Used for handling events pulled from the queue
  event_handler: &MyModule.handle/1,
  # Set this to false to prevent queue polling
  poll: true,
}

The function passed as the event_handler is expected to take a single argument, which will be the decoded JSON data popped from the queue.

Usage

Start it supervised however idk. Pass the stuff in the configuration section above.

GenServer.cast :your_queue, {:queue, "memes"}

Q wil automatically call the function passed as event_handler when there is a new queue item available.

Installation

Add this to your mix.exs:

def deps do
  [
    {:q, github: "mewna/q}
  ]
end

About

Q is a simple, JSON-based, Redis-backed message queue system for Elixir.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages