README.md in hawking-0.1 vs README.md in hawking-0.2

- old
+ new

@@ -1,58 +1,62 @@ Hawking ======= +[![Gem Version](https://badge.fury.io/rb/hawking.png)](http://badge.fury.io/rb/hawking) [![Build Status](https://travis-ci.org/rogeriozambon/hawking.png?branch=master)](https://travis-ci.org/rogeriozambon/hawking) [![Code Climate](https://codeclimate.com/github/rogeriozambon/hawking.png)](https://codeclimate.com/github/rogeriozambon/hawking) -Background job queueing using Socket. Inspired in the [Stalkeg gem](https://github.com/han/stalker). +Background job queueing using TCPSocket. Inspired in the [Stalker gem](https://github.com/han/stalker). Queueing jobs ------------- From anywhere in your app: - require 'hawking' +~~~.ruby +require 'hawking' - Hawking::Queue.new('email.send', :to => 'joe@example.com') - Hawking::Queue.new('post.cleanup', :id => post.id) +hawking = Hawking::Queue.new +hawking.put 'email.send', to: 'joe@example.com' +hawking.put 'post.cleanup', id: post.id +~~~ + Working jobs ------------ In a standalone file, typically jobs.rb or worker.rb: - require 'hawking' +~~~.ruby +require 'hawking' - extend Hawking +extend Hawking - job 'email.send' do |args| - Pony.send(:to => args['to'], :subject => "Hello there") - end +job 'email.send' do |data| + Pony.send(to: data[:to], subject: "Hello there") +end - job 'post.cleanup' do |args| - Post.find(args['id']).cleanup - end +job 'post.cleanup' do |data| + Post.find(data[:id]).cleanup +end +~~~ Running ------- Hawking: $ sudo gem install hawking -Now run a worker using the stalk binary: +Now run a worker using the binary: $ hawking jobs.rb Working 2 jobs: [ email.send post.cleanup ] - Working send.email (email=hello@example.com) -Hawk will log to stdout as it starts working each job. + Working send.email ({:to=>joe@example.com}) + Working post.cleanup ({:id=>1}) -Filter to a list of jobs you wish to run with an argument: - - $ hawking jobs.rb email.send - Working 1 jobs: [ email.send ] +Hawking will log to stdout as it starts working each job. Running the tests ----------------- $ rake spec