bnorton / howler

An asynchronous message queue that's always chewing on something.
MIT License
2 stars 1 forks source link

Howler

An asynchronous message queue that's always chewing on something.


Advantages

Usage

  1. Rails 3 + Redis
  2. gem 'howler' in your Gemfile.
  3. bundle install.
  4. From the root of the Rails project run [bundle exec] howler.

Configuration

Howler listens to configuration and updates accordingly.

  # Scale Workers
  Howler::Config[:concurrency] = 75

Queueing Interface

class User [< ActiveRecord::Base]
  async :fetch_content

  def self.fetch_content(user_id)
    ...
  end
end

User.async_fetch_content(user.id)
#=> true

Message Retry Handling

  def self.fetch_content(user_id)
    user = User.find(user_id)

    unless user.fetchable?
      raise Howler::Message::Retry(:after => 1.minute, :ttl => 10.minutes)
    end

    ... # fetch content
  end

Exception Notification

  def self.fetch_content(user_id)
    ...
    begin
      # Try to fetch /home_timeline for the user
    rescue Twitter::Error::ServiceUnavailable => error
      raise Howler::Message::Notify.new(erorr)
    end

    ... # process the timeline
  end

Message Passing

  def fetch_content(user_id)

    ... # done fetching content
    Howler::Config[user_id] = {:fetched_at => Time.now, :status => 'success'}.to_json

    # Then to delete a key simply assign nil
    Howler::Config[user_id] = nil
  end

Dashboard (In Development)


Get rid of your Exception Notifier