Giter VIP home page Giter VIP logo

komrade-client's Introduction

Komrade Client

A small, Ruby superset of Komrade's HTTP API

Setup

Email [email protected] with your heroku email address for a beta pass.

$ heroku addons:add komrade:test
$ gem install komrade-client

Usage

  1. Install Gem
  2. Minimalist Example
  3. Rails Example
  4. Komrade Dashboard

Install Gem

Gemfile

source :rubygems
gem 'komrade-client', '~> 1.0.15'

Minimalist Example

This is the absolute bare minimum to see Komrade in action.

$ export KOMRADE_URL=https://{heroku_username}:{heroku_password}@service.komrade.io
$ ruby -r komrade-client -e 'Komrade::Queue.enqueue("puts", "hello world")'
$ ruby -r komrade-client -e 'puts Komrade::Queue.dequeue'

You should see "hello world" output in your terminal.

Rails Example

To get started add gem 'komrade-client', '~> 1.0.15' to your Gemfile. Then run rails g komrade. This will add a komrade-worker process to your Procfile (feel free to edit your Procfile by hand if you prefer).

Your Procfile now should look something like this:

web: bundle exec rails s
komrade-worker: bundle exec rake komrade:work

This is an example of a Rails model that sends a welcome email upon user sign up. The only code that is unique to Komrade here is the Komrade::Queue.enqueue method. This method takes a method as a string and any parameters you want to pass to that method.

class User < ActiveRecord::Base
  after_create :enqueue_welcome_email

  def self.send_welcome_email(id)
    if u = find(id)
      Mailer.welcome(u).deliver
    end
  end

  def enqueue_welcome_email
    Komrade::Queue.enqueue("User.send_welcome_email", self.id)
  end
end

When you deploy your code, the will queue be ready to accept jobs, and the worker process is waiting to do the work.

Komrade Dashboard

$ heroku addons:open komrade:test

img

komrade-client's People

Contributors

bobbywilson0 avatar wuputah avatar

Stargazers

ruedap avatar Matias Korhonen avatar Junya Ogura avatar Vesa Vänskä avatar

Watchers

Ryan Smith avatar James Cloos avatar  avatar

Forkers

epictetus wuputah

komrade-client's Issues

Regression in 1.0.11

All jobs returning this:

undefined local variable or method `limit' for #<Komrade::Worker:0x000000027b0460 @running=true>

Maybe time for some tests? 😁

SSL Warning on SSO page

Not an issue with the client per se, but:

http://cl.ly/image/2D1W2q0R4644

I proceeded, then saw this:

http://cl.ly/image/0u0y0h2T1a2e

Another round of heroku addons:open komrade:test, though, and now I'm in.

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.