Skip to content

Commit

Permalink
Documentation updated, we have a 2.1.4-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethkalmer committed Jan 26, 2010
1 parent 463397e commit 69086a9
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
work/
logs/
pkg/
.yardoc
doc/
44 changes: 13 additions & 31 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
= ruote-amqp

* http://github.com/kennethkalmer/ruote-amqp
* http://rdoc.info/projects/kennethkalmer/ruote-amqp
* http://ruote.rubyforge.org

== DESCRIPTION:

ruote-amqp provides an AMQP participant/listener pair that allows you to
distribute workitems out to AMQP consumers for processing.
distribute workitems out to AMQP consumers for processing, as well as launching
processes over AMQP.

To learn more about remote participants in ruote please see
http://openwferu.rubyforge.org/part.html
http://ruote.rubyforge.org/part_implementations.html

== FEATURES/PROBLEMS:

* Flexible participant for sending workitems
* Flexible listener for receiving replies
* Flexible launch item listener for launching processes over AMQP
* Fully evented (thanks to the amqp gem)

== SYNOPSIS:

Please review the detailed RDOC in RuoteAMQP::Participant and Ruote::AMQP::Listener
Please review the rdoc in RuoteAMQP::Participant and Ruote::AMQP::Listener

== REQUIREMENTS:

* ruote[http://ruote.rubyforge.org] 2.0.0 or later
* amqp[http://github.com/tmm1/amqp] 0.6.1 or later
* ruote[http://ruote.rubyforge.org] 2.1.4 or later
* amqp[http://github.com/tmm1/amqp] 0.6.6 or later
* rufus-json[http://github.com/jmettraux/rufus-json] 0.1.0 or later
* rabbitmq[http://www.rabbitmq.com/] 1.6.0 or later

NOTE: It might be required that you build the amqp gem yourself.

ruote 2.0.0 is currently only available to build on your own since John
Mettraux is working tirelessly to ship a stable ruote 2.0. To build your own ruote
2.0.0 gem run these commands:

$ git clone git://github.com/jmettraux/ruote.git
$ cd ruote
$ git checkout --track origin/ruote2.0
$ rake gem
$ sudo gem install pkg/ruote-2.0.0.gem

Please note that this requires Rubygems 1.3.2 or newer to work

== INSTALL:

Please be sure to have read the requirements section above
Expand All @@ -52,22 +42,14 @@ Please be sure to have read the requirements section above
To run the tests you need the following requirements met, or the testing environment
will fail horribly.

=== kennethkalmer-amqp

* kennethkalmer-amqp[http://github.com/kennethkalmer/amqp] 0.6.4

It contains a one-line patch as per tmm1's instructions in #eventmachine, which
allows the reactor to be stopped and started several times in a running Ruby
process.

=== RabbitMQ vhost

The tests use dedicated vhost on a running AMQP broker. To configure RabbitMQ
you can run the following commands:

# rabbitmqctl add_vhost /ruote-test
# rabbitmqctl add_vhost ruote-test
# rabbitmqctl add_user ruote ruote
# rabbitmqctl set_permissions -p /ruote-test ruote '.*' '.*' '.*'
# rabbitmqctl set_permissions -p ruote-test ruote '.*' '.*' '.*'

If you need to change the AMQP configuration used by the tests, edit the
+spec/spec_helper.rb+ file.
Expand All @@ -81,13 +63,13 @@ to write your remote participants.
daemon-kit offers plenty of convenience for remote participants and includes
a code generator for ruote remote participants.

DaemonKit doesn't currently support ruote 2.0, support is forthcoming.
DaemonKit doesn't currently support ruote 2.1, support is forthcoming.

== LICENSE:

(The MIT License)

Copyright (c) 2009 Kenneth Kalmer
Copyright (c) 2010 Kenneth Kalmer

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ begin
gemspec.authors = ['kenneth.kalmer@gmail.com']
gemspec.extra_rdoc_files.include '*.txt'

gemspec.add_dependency 'json'
gemspec.add_dependency 'rufus-json', '>= 0.1.0'
gemspec.add_dependency 'amqp', '>= 0.6.6'
gemspec.add_dependency 'ruote', '= 2.1.4'
gemspec.add_development_dependency 'rspec'
Expand Down
2 changes: 1 addition & 1 deletion lib/ruote-amqp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
module RuoteAMQP

VERSION = '2.1.0'
VERSION = '2.1.4pre'

autoload 'Participant', 'ruote-amqp/participant'
autoload 'WorkitemListener', 'ruote-amqp/workitem_listener'
Expand Down
25 changes: 13 additions & 12 deletions lib/ruote-amqp/launchitem_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ module RuoteAMQP
# The LaunchitemListener expects JSON formatted messages that look like this:
#
# {
# "definition" : "URL or process definition",
# "fields" : { "key" : "value" }
# "definition" : "process definition",
# "fields" : { "key" : "value" },
# "variables" : { "key" : "value" }
# }
#
# The definition key can be a complete string representation of a business
# process, or a URL pointing to the process definition. Note that the
# engine needs to be configured to load process definitions from URL's
# The definition key is a complete string representation of a business process.
#
# == Configuration
#
Expand All @@ -26,13 +25,13 @@ module RuoteAMQP
# key (in the optional hash). If no +queue+ key is provided, the listener
# will subscribe to the +ruote_launchitems+ direct exchange for launchitems.
#
# The listener requires version 0.6.1 or later of the amqp gem.
# The listener requires version 0.6.6 or later of the amqp gem.
#
# == Usage
#
# Register the listener with the engine:
# Register the engine with the listener:
#
# engine.register_listener( RuoteAMQP::LaunchitemListener )
# RuoteAMQP::LaunchitemListener.new( engine_instance )
#
# The workitem listener leverages the asynchronous nature of the amqp gem,
# so no timers are setup when initialized.
Expand All @@ -49,9 +48,11 @@ def queue

end

def initialize( storage, queue = nil )

@storage = storage
# Start a new LaunchItem listener
#
# @param [ Ruote::Engine ] An instance of a ruote engine
# @param [ String ] Optional queue name
def initialize( engine, queue = nil )

self.class.queue = queue if queue

Expand All @@ -62,7 +63,7 @@ def initialize( storage, queue = nil )
# Do nothing, we're going down
else
launchitem = decode_launchitem( message )
@storage.launch( *launchitem )
engine.launch( *launchitem )
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ruote-amqp/participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def consume( workitem )
end

def stop
RuoteAMQP.shutdown_reactor!
RuoteAMQP.stop!
end

def cancel(fei, flavour)
Expand Down
14 changes: 9 additions & 5 deletions lib/ruote-amqp/workitem_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ module RuoteAMQP
# to the +ruote_workitems+ direct exchange for workitems, otherwise it will
# subscribe to the direct exchange provided.
#
# The participant requires version 0.6.1 or later of the amqp gem.
# The participant requires version 0.6.6 or later of the amqp gem.
#
# == Usage
#
# Register the listener with the engine:
# Register the engine or storage with the listener:
#
# engine.register_listener( RuoteAMQP::WorkitemListener )
# RuoteAMQP::WorkitemListener.new( engine_or_storage )
#
# The workitem listener leverages the asynchronous nature of the amqp gem,
# so no timers are setup when initialized.
Expand All @@ -47,9 +47,13 @@ def queue

end

def initialize( storage, queue = nil )
# Starts a new WorkitemListener
#
# @param [ Ruote::Engine, Ruote::Storage ] A configured ruote engine or storage instance
# @param [ String ] An optional queue name
def initialize( engine_or_storage, queue = nil )

@storage = storage
@storage = engine_or_storage.respond_to?( :storage ) ? engine_or_storage.storage : engine_or_storage

self.class.queue = queue if queue

Expand Down
2 changes: 1 addition & 1 deletion spec/workitem_listener_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@engine.register_participant( :amqp, RuoteAMQP::Participant )

RuoteAMQP::WorkitemListener.new( @engine.storage )
RuoteAMQP::WorkitemListener.new( @engine )

fei = @engine.launch pdef

Expand Down

0 comments on commit 69086a9

Please sign in to comment.