amqp-daemon-kit 0.1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/.gitignore +5 -0
  2. data/Configuration.txt +110 -0
  3. data/Deployment.txt +113 -0
  4. data/History.txt +131 -0
  5. data/Logging.txt +96 -0
  6. data/PostInstall.txt +6 -0
  7. data/README.rdoc +132 -0
  8. data/Rakefile +29 -0
  9. data/RuoteParticipants.txt +113 -0
  10. data/TODO.txt +27 -0
  11. data/bin/daemon-kit +18 -0
  12. data/config/website.yml +2 -0
  13. data/daemon-kit.gemspec +265 -0
  14. data/lib/daemon_kit.rb +60 -0
  15. data/lib/daemon_kit/abstract_logger.rb +249 -0
  16. data/lib/daemon_kit/application.rb +230 -0
  17. data/lib/daemon_kit/arguments.rb +165 -0
  18. data/lib/daemon_kit/commands/console.rb +38 -0
  19. data/lib/daemon_kit/commands/destroy.rb +10 -0
  20. data/lib/daemon_kit/commands/generate.rb +10 -0
  21. data/lib/daemon_kit/config.rb +113 -0
  22. data/lib/daemon_kit/console_daemon.rb +2 -0
  23. data/lib/daemon_kit/core_ext.rb +1 -0
  24. data/lib/daemon_kit/core_ext/configurable.rb +96 -0
  25. data/lib/daemon_kit/core_ext/string.rb +22 -0
  26. data/lib/daemon_kit/cron.rb +67 -0
  27. data/lib/daemon_kit/cucumber/world.rb +38 -0
  28. data/lib/daemon_kit/deployment/capistrano.rb +516 -0
  29. data/lib/daemon_kit/dk_amqp.rb +39 -0
  30. data/lib/daemon_kit/em.rb +43 -0
  31. data/lib/daemon_kit/error_handlers/base.rb +32 -0
  32. data/lib/daemon_kit/error_handlers/hoptoad.rb +180 -0
  33. data/lib/daemon_kit/exceptions.rb +15 -0
  34. data/lib/daemon_kit/generators.rb +67 -0
  35. data/lib/daemon_kit/generators/base.rb +60 -0
  36. data/lib/daemon_kit/initializer.rb +449 -0
  37. data/lib/daemon_kit/jabber.rb +171 -0
  38. data/lib/daemon_kit/nanite.rb +7 -0
  39. data/lib/daemon_kit/nanite/agent.rb +77 -0
  40. data/lib/daemon_kit/pid_file.rb +61 -0
  41. data/lib/daemon_kit/ruote_participants.rb +125 -0
  42. data/lib/daemon_kit/ruote_pseudo_participant.rb +68 -0
  43. data/lib/daemon_kit/ruote_workitem.rb +187 -0
  44. data/lib/daemon_kit/safety.rb +84 -0
  45. data/lib/daemon_kit/tasks.rb +2 -0
  46. data/lib/daemon_kit/tasks/environment.rake +11 -0
  47. data/lib/daemon_kit/tasks/framework.rake +123 -0
  48. data/lib/daemon_kit/tasks/god.rake +62 -0
  49. data/lib/daemon_kit/tasks/log.rake +8 -0
  50. data/lib/daemon_kit/tasks/monit.rake +29 -0
  51. data/lib/daemon_kit/vendor/thor-0.13.6/CHANGELOG.rdoc +89 -0
  52. data/lib/daemon_kit/vendor/thor-0.13.6/LICENSE +20 -0
  53. data/lib/daemon_kit/vendor/thor-0.13.6/README.rdoc +297 -0
  54. data/lib/daemon_kit/vendor/thor-0.13.6/Thorfile +69 -0
  55. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor.rb +244 -0
  56. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions.rb +296 -0
  57. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/create_file.rb +103 -0
  58. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/directory.rb +91 -0
  59. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/empty_directory.rb +134 -0
  60. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/file_manipulation.rb +223 -0
  61. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/inject_into_file.rb +104 -0
  62. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/base.rb +540 -0
  63. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/file_binary_read.rb +9 -0
  64. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  65. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/ordered_hash.rb +100 -0
  66. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/error.rb +30 -0
  67. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/group.rb +271 -0
  68. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/invocation.rb +180 -0
  69. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser.rb +4 -0
  70. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/argument.rb +67 -0
  71. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/arguments.rb +150 -0
  72. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/option.rb +128 -0
  73. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/options.rb +169 -0
  74. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb +66 -0
  75. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/runner.rb +314 -0
  76. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell.rb +83 -0
  77. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/basic.rb +239 -0
  78. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/color.rb +108 -0
  79. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/task.rb +102 -0
  80. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/util.rb +224 -0
  81. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/version.rb +3 -0
  82. data/lib/daemon_kit/xmpp.rb +100 -0
  83. data/lib/generators/daemon_kit/amqp/USAGE +5 -0
  84. data/lib/generators/daemon_kit/amqp/amqp_generator.rb +24 -0
  85. data/lib/generators/daemon_kit/amqp/templates/config/amqp.yml +28 -0
  86. data/lib/generators/daemon_kit/amqp/templates/config/pre-daemonize/amqp.rb +7 -0
  87. data/lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb +37 -0
  88. data/lib/generators/daemon_kit/app/USAGE +7 -0
  89. data/lib/generators/daemon_kit/app/app_generator.rb +140 -0
  90. data/lib/generators/daemon_kit/app/templates/Gemfile +12 -0
  91. data/lib/generators/daemon_kit/app/templates/README.tt +58 -0
  92. data/lib/generators/daemon_kit/app/templates/Rakefile +6 -0
  93. data/lib/generators/daemon_kit/app/templates/bin/daemon.tt +7 -0
  94. data/lib/generators/daemon_kit/app/templates/config/arguments.rb +12 -0
  95. data/lib/generators/daemon_kit/app/templates/config/boot.rb +70 -0
  96. data/lib/generators/daemon_kit/app/templates/config/environment.rb.tt +26 -0
  97. data/lib/generators/daemon_kit/app/templates/config/environments/development.rb +2 -0
  98. data/lib/generators/daemon_kit/app/templates/config/environments/production.rb +5 -0
  99. data/lib/generators/daemon_kit/app/templates/config/environments/test.rb +2 -0
  100. data/lib/generators/daemon_kit/app/templates/config/post-daemonize/readme +5 -0
  101. data/lib/generators/daemon_kit/app/templates/config/pre-daemonize/readme +12 -0
  102. data/lib/generators/daemon_kit/app/templates/lib/%app_name%.rb +2 -0
  103. data/lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb +18 -0
  104. data/lib/generators/daemon_kit/app/templates/script/console +3 -0
  105. data/lib/generators/daemon_kit/app/templates/script/destroy +3 -0
  106. data/lib/generators/daemon_kit/app/templates/script/generate +3 -0
  107. data/lib/generators/daemon_kit/capistrano/capistrano_generator.rb +26 -0
  108. data/lib/generators/daemon_kit/capistrano/templates/Capfile +10 -0
  109. data/lib/generators/daemon_kit/capistrano/templates/USAGE +10 -0
  110. data/lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt +67 -0
  111. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/logrotate.erb +13 -0
  112. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt +6 -0
  113. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt +6 -0
  114. data/lib/generators/daemon_kit/capistrano/templates/config/environments/staging.rb +0 -0
  115. data/lib/generators/daemon_kit/cron/USAGE +5 -0
  116. data/lib/generators/daemon_kit/cron/cron_generator.rb +24 -0
  117. data/lib/generators/daemon_kit/cron/templates/config/pre-daemonize/cron.rb +11 -0
  118. data/lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb +48 -0
  119. data/lib/generators/daemon_kit/cucumber/USAGE +11 -0
  120. data/lib/generators/daemon_kit/cucumber/cucumber_generator.rb +45 -0
  121. data/lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb +2 -0
  122. data/lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory +0 -0
  123. data/lib/generators/daemon_kit/cucumber/templates/features/support/env.rb +7 -0
  124. data/lib/generators/daemon_kit/cucumber/templates/script/cucumber +7 -0
  125. data/lib/generators/daemon_kit/cucumber/templates/tasks/cucumber.rake +13 -0
  126. data/lib/generators/daemon_kit/nanite_agent/USAGE +5 -0
  127. data/lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb +29 -0
  128. data/lib/generators/daemon_kit/nanite_agent/templates/config/nanite.yml +35 -0
  129. data/lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize/nanite_agent.rb +6 -0
  130. data/lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb +11 -0
  131. data/lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb +31 -0
  132. data/lib/generators/daemon_kit/rspec/USAGE +5 -0
  133. data/lib/generators/daemon_kit/rspec/rspec_generator.rb +20 -0
  134. data/lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb +11 -0
  135. data/lib/generators/daemon_kit/rspec/templates/spec/spec.opts +1 -0
  136. data/lib/generators/daemon_kit/rspec/templates/spec/spec_helper.rb +23 -0
  137. data/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake +21 -0
  138. data/lib/generators/daemon_kit/ruote/USAGE +5 -0
  139. data/lib/generators/daemon_kit/ruote/ruote_generator.rb +29 -0
  140. data/lib/generators/daemon_kit/ruote/templates/config/amqp.yml +30 -0
  141. data/lib/generators/daemon_kit/ruote/templates/config/pre-daemonize/ruote.rb +13 -0
  142. data/lib/generators/daemon_kit/ruote/templates/config/ruote.yml +23 -0
  143. data/lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb +4 -0
  144. data/lib/generators/daemon_kit/ruote/templates/lib/sample.rb +26 -0
  145. data/lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb +33 -0
  146. data/lib/generators/daemon_kit/test_unit/USAGE +5 -0
  147. data/lib/generators/daemon_kit/test_unit/templates/tasks/test_unit.rake +7 -0
  148. data/lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt +9 -0
  149. data/lib/generators/daemon_kit/test_unit/templates/test/test_helper.rb +6 -0
  150. data/lib/generators/daemon_kit/test_unit/test_unit_generator.rb +20 -0
  151. data/lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb +6 -0
  152. data/lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml +29 -0
  153. data/lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb +27 -0
  154. data/lib/generators/daemon_kit/xmpp/xmpp_generator.rb +24 -0
  155. data/script/console +10 -0
  156. data/script/destroy +14 -0
  157. data/script/generate +14 -0
  158. data/script/txt2html +71 -0
  159. data/spec/abstract_logger_spec.rb +126 -0
  160. data/spec/argument_spec.rb +70 -0
  161. data/spec/config_spec.rb +83 -0
  162. data/spec/configurable_spec.rb +56 -0
  163. data/spec/daemon_kit_spec.rb +7 -0
  164. data/spec/error_handlers_spec.rb +23 -0
  165. data/spec/fixtures/env.yml +15 -0
  166. data/spec/fixtures/noenv.yml +4 -0
  167. data/spec/initializer_spec.rb +26 -0
  168. data/spec/spec.opts +1 -0
  169. data/spec/spec_helper.rb +27 -0
  170. data/tasks/cucumber.rake +13 -0
  171. data/tasks/rspec.rake +20 -0
  172. data/tasks/tests.rake +6 -0
  173. data/templates/god/god.erb +69 -0
  174. data/templates/monit/monit.erb +14 -0
  175. data/test/test_amqp_generator.rb +48 -0
  176. data/test/test_cron_generator.rb +45 -0
  177. data/test/test_daemon-kit_generator.rb +84 -0
  178. data/test/test_daemon_kit_config.rb +28 -0
  179. data/test/test_deploy_capistrano_generator.rb +48 -0
  180. data/test/test_generator_helper.rb +29 -0
  181. data/test/test_helper.rb +7 -0
  182. data/test/test_nanite_agent_generator.rb +49 -0
  183. data/test/test_ruote_generator.rb +51 -0
  184. data/test/test_test_unit_generator.rb +46 -0
  185. metadata +302 -0
@@ -0,0 +1,6 @@
1
+
2
+ For more information on daemon-kit, see http://kit.rubyforge.org/daemon-kit
3
+
4
+ To get started quickly run 'daemon-kit' without any arguments
5
+
6
+
@@ -0,0 +1,132 @@
1
+ = Daemon Kit
2
+
3
+ * http://kit.rubyforge.org/daemon-kit/rdoc/
4
+ * http://kit.rubyforge.org/daemon-kit (coming soon)
5
+ * http://groups.google.com/group/daemon-kit (daemon-kit@googlegroups.com)
6
+ * #daemon-kit on Freenode
7
+
8
+ == Description
9
+
10
+ Daemon Kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.
11
+
12
+ Using simple built-in generators it is easy to create evented and non-evented daemons that perform a multitude of different tasks.
13
+
14
+ Supported generators:
15
+
16
+ * XMPP bot (evented)
17
+ * AMQP consumer (evented)
18
+ * Nanite agent
19
+ * Cron-style daemon
20
+ * ruote remote participants
21
+
22
+ == Features/Problems
23
+
24
+ * Build it
25
+ * Review TODO.txt
26
+
27
+ == Synopsis
28
+
29
+ $ daemon-kit -h
30
+
31
+ Get some help
32
+
33
+ $ daemon-kit [/path/to/your/daemon] [options]
34
+
35
+ The above command generates a skeleton daemon environment for you to adapt.
36
+
37
+ $ daemon-kit [/path/to/your/daemon] -i xmpp
38
+
39
+ Use the 'xmpp' generator instead of the default one.
40
+
41
+ == Generators
42
+
43
+ Currently six generators exist: default, xmpp, amqp, cron, nanite & ruote
44
+
45
+ The default generator creates a simple daemon with an infinite loop inside that you can adapt.
46
+
47
+ === XMPP Generator
48
+
49
+ The jabber generator creates a simple daemon that leverages the blather[http://blather.squishtech.com/] gem to process inbound messages. The daemon will manage the roster and other little tasks, leaving you to provide the hooks for processing messages, presence notifications and subscription request.
50
+
51
+ === Cron Generator
52
+
53
+ The cron generator creates a simple daemon that leverages the rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] gem to create a simple cron-lie daemon. Please be aware that this daemon could never be a replacement for the battle-tested cron[http://www.gentoo.org/doc/en/cron-guide.xml] utility shipped standard with most *nix distributions.
54
+
55
+ === AMQP Consumer Generator
56
+
57
+ The AMQP generator creates a simple daemon that has all the stub code and configuration in place to help you write AMQP consumers quickly and effectively. The generated daemon relies on the presence of the amqp[http://github.com/tmm1/amqp] gem.
58
+
59
+ === Nanite Agent Generator
60
+
61
+ The nanite[http://github.com/ezmobius/nanite] agent generator gets you up and running with nanite agents very quickly.
62
+
63
+ === ruote Remote Participants
64
+
65
+ The ruote[http://openwfe.rubyforge.org] remote participant generator speeds up the development of workflow participants that run outside of the Ruby process that houses the engine. Daemon-kit handles all the communication and delegation logic, allowing you to focus purely on your participant's activities.
66
+
67
+ == Requirements
68
+
69
+ * Ruby 1.8.7 or later (developed on REE/1.9.1)
70
+ * eventmachine-0.12.10[http://rubyeventmachine.com]
71
+ * rspec (for writing/running your specs)
72
+
73
+ == Generator Requirements
74
+
75
+ Depending on the generator you choose for your daemon, it might require additional gems to run.
76
+
77
+ * xmpp - blather[http://blather.squishtech.com/]
78
+ * cron - rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] (at least version 2.0.0)
79
+ * amqp - amqp[http://github.com/tmm1/amqp]
80
+ * nanite - nanite[http://github.com/ezmobius/nanite]
81
+ * ruote - none, although ruote[http://openwfe.rubyforge.org] should probably be running somewhere
82
+
83
+ The generators are all written using Thor[http://rdoc.info/rdoc/wycats/thor], which is bundled with daemon-kit and not needed for running any of the generators.
84
+
85
+ == Install
86
+
87
+ Currently recommended to stick to the git repo:
88
+
89
+ $ git clone git://github.com/kennethkalmer/daemon-kit.git
90
+ $ rake build
91
+ $ gem install pkg/daemon-kit-X.X.X.gem
92
+
93
+ Stable versions, when released are available directly from Gemcutter:
94
+
95
+ $ gem install daemon-kit
96
+
97
+ == Upgrading
98
+
99
+ When upgrading daemons generated from earlier versions of daemon-kit, it is easier in most cases to re-generate the daemon. Since 0.1.8 the generators use Thor, which allows you to review a diff of each file before deciding to overwrite it.
100
+
101
+ == Further reading
102
+
103
+ * Configuration.txt
104
+ * Deployment.txt
105
+ * Logging.txt
106
+ * RuoteParticipants.txt
107
+ * http://www.opensourcery.co.za/tag/daemon-kit/
108
+
109
+ == License
110
+
111
+ (The MIT License)
112
+
113
+ Copyright (c) 2009 Kenneth Kalmer (Internet Exchange CC, Clear Planet Information Solutions Pty Ltd)
114
+
115
+ Permission is hereby granted, free of charge, to any person obtaining
116
+ a copy of this software and associated documentation files (the
117
+ 'Software'), to deal in the Software without restriction, including
118
+ without limitation the rights to use, copy, modify, merge, publish,
119
+ distribute, sublicense, and/or sell copies of the Software, and to
120
+ permit persons to whom the Software is furnished to do so, subject to
121
+ the following conditions:
122
+
123
+ The above copyright notice and this permission notice shall be
124
+ included in all copies or substantial portions of the Software.
125
+
126
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
127
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
128
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
129
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
130
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
131
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
132
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ Dir['tasks/**/*.rake'].each { |t| load t }
2
+
3
+ require File.dirname(__FILE__) + '/lib/daemon_kit'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = 'daemon-kit'
9
+ gemspec.version = DaemonKit::VERSION
10
+ gemspec.summary = 'Opinionated framework for Ruby daemons'
11
+ gemspec.description = 'daemon-kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.'
12
+ gemspec.email = 'kenneth.kalmer@gmail.com'
13
+ gemspec.homepage = 'http://github.com/kennethkalmer/daemon-kit'
14
+ gemspec.authors = ['kenneth.kalmer@gmail.com']
15
+ gemspec.post_install_message = IO.read('PostInstall.txt')
16
+ gemspec.extra_rdoc_files.include '*.txt'
17
+ gemspec.files.include("lib/generators/**/*", "lib/daemon_kit/vendor/**/*")
18
+
19
+ gemspec.add_dependency 'eventmachine', '>=0.12.10'
20
+ gemspec.add_development_dependency 'rspec'
21
+ gemspec.add_development_dependency 'cucumber'
22
+ end
23
+ Jeweler::GemcutterTasks.new
24
+ rescue LoadError
25
+ puts "Jeweler not available. Install it with 'gem install jeweler'"
26
+ end
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ task :default => [:spec] #, :features]
@@ -0,0 +1,113 @@
1
+ = Writing remote ruote participants with daemon-kit
2
+
3
+ daemon-kit is an ideal housing for remote ruote participants, providing a lot
4
+ of convenience in terms of receiving and sending workitems, delegating work to
5
+ pseudo-participant classes, handling configuration of the communication channel
6
+ between ruote and the remote participant, and much more.
7
+
8
+ == What is ruote?
9
+
10
+ Ruote is a Ruby workflow engine. It is a powerful tool for defining, running and
11
+ orchestrating business processes.
12
+
13
+ * http://openwferu.rubyforge.org/
14
+ * http://www.opensourcery.co.za/2009/03/04/ruote-in-20-minutes/
15
+ * http://www.opensourcery.co.za/2009/07/06/driving-business-processes-in-ruby/
16
+
17
+ == What are remote participants?
18
+
19
+ Remote participants are participants that perform their work in a different
20
+ Ruby processes from the one running the engine. This is useful in two cases,
21
+ possibily many more, that involves autonomous participants.
22
+
23
+ * Autonomous participants located on remote servers, driven by identity
24
+ * Clustering autonomous participants to process workitems from a queue
25
+
26
+ To learn more about the differences between local and remote participants
27
+ please see http://openwferu.rubyforge.org/part.html
28
+
29
+ Currently on the AMQP components are in place in daemon-kit, with XMPP coming
30
+ soon.
31
+
32
+ == Creating a remote participant with daemon-kit
33
+
34
+ Generate your daemon using the 'ruote' generator:
35
+
36
+ $ daemon_kit partd -i ruote
37
+
38
+ Make sure you have the JSON gem install, and the AMQP gem as well.
39
+
40
+ == Configuring the daemon
41
+
42
+ You need to review +config/ruote.yml+ to specify the AMQP queues that the daemon
43
+ will subscribe to for receiving workitems. You'll also need to configure the
44
+ AMQP gem be updating +config/amqp.yml+
45
+
46
+ The generated daemon in +libexec/+ already defaults to using AMQP as a transport
47
+ for workitems.
48
+
49
+ == Writing pseudo-participants
50
+
51
+ Pseudo-participants in daemon-kit are pure Ruby classes. Implement your classes
52
+ in +lib/+ and require them from +lib/<daemon_name>.rb+.
53
+
54
+ Register your classes as pseudo-participants by registering them in the daemon
55
+ file in +libexec+, just as the Sample class is registered in the generated
56
+ code. Your class will be instantiated upon registration, and will be re-used
57
+ for every incoming workitem passed to it.
58
+
59
+ All your public methods in the pseudo-participant classes should be accept
60
+ a single parameter, which is a ruote workitem in pure Hash form.
61
+
62
+ == Wiring up the remote participant in ruote
63
+
64
+ See the complete code here: http://gist.github.com/144861
65
+
66
+ A sample process definition might look something like this:
67
+
68
+ class QuoteProcess < OpenWFE::ProcessDefinition
69
+ sequence do
70
+ kit :command => '/sample/quote', :queue => 'work1'
71
+
72
+ console
73
+ end
74
+ end
75
+
76
+ +kit+ in the above process definition is registered with the ruote engine as an
77
+ AMQPParticipant. The AMQPParticipant delivers workitems to the specified AMQP
78
+ queue.
79
+
80
+ Based on the values in +config/ruote.yml+, your daemon will be subscribed to
81
+ those queues.
82
+
83
+ The second part is delegating the workitem inside the daemon to the correct
84
+ pseudo-participant. This is handled by the +:command+ parameter in the process
85
+ definition. DaemonKit::Workitem looks at the command parameter of the incoming
86
+ workitem, and then finds a registered pseudo-participant instance and calls the
87
+ requested method on that class.
88
+
89
+ The +:command+ parameter follows the following convention (stolen shamelessly
90
+ from Nanite):
91
+
92
+ :command => '/class_name/method_name'
93
+
94
+ When classes are registered, the name of the class is downcased and camel-case
95
+ words are separated by underscores. Method names are not changed, but methods
96
+ are required to be public.
97
+
98
+ == Processing workitems and replying to the engine
99
+
100
+ The methods called in the pseudo-participants receive a single parameter, a
101
+ ruote workitem as a hash. The participant is then free to analyze the hash
102
+ and perform the appropriate actions required. The return value of the method
103
+ is discarded, and the workitem is returned back to the engine. If the method
104
+ modified the workitem, these changes will be sent along as well.
105
+
106
+ == Random other notes
107
+
108
+ Apart from configuring the AMPQ client (or XMPP in future) and the ruote.yml
109
+ file, daemon developers don't need to worry about anything related to receiving
110
+ workitems or sending replies.
111
+
112
+ Our aim is to allow you to swap between participants on both sides of the
113
+ transport without changing any of your code.
@@ -0,0 +1,27 @@
1
+ = DaemonKit TODO List
2
+
3
+ This is purely a drop in the bucket of what has to come...
4
+
5
+ * Support for chroot'ing
6
+ * Altering process names (fully and temporary appending)
7
+ * bleak_house support
8
+ * Support for tweaking REE environment variables prior to launch (bash wrapper)
9
+ * Clustering support (run multiple workers out of same project)
10
+ * [IN PROGRESS] Error handling to the degree Rails does
11
+ * Support for custom error handlers in the project
12
+ * Easy configuration of an ORM of choice, including patching it if needed (ActiveRecord *cough*)
13
+ * Improved generators for creating skeleton daemons:
14
+ * Empty periodic event loop
15
+ * Empty periodic loop (non-evented)
16
+ * Queue (SQS, etc) pollers
17
+ * Rake tasks for generating:
18
+ * Sys-V style init scripts
19
+ * Plenty of docs, seriously a lot of docs
20
+ * Specs & features, tons of them too
21
+ * Integration tests for the specific daemons
22
+ * Some level of thread safety, or mechanisms to ease thread safety
23
+ * Built in utilities:
24
+ * Fibre pool for 1.9
25
+ * Some activesupport-esque functions until activesupport 3.0 hits the streets
26
+ * DRY up the following:
27
+ * Loading configuration files for the daemons
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'daemon_kit'
5
+ rescue LoadError
6
+ $:.unshift File.expand_path( '../../lib', __FILE__ )
7
+ require 'daemon_kit'
8
+ end
9
+
10
+ if %w(-v --version).include? ARGV.first
11
+ puts "#{File.basename($0)} #{DaemonKit::VERSION} (http://github.com/kennethkalmer/daemon-kit)"
12
+ exit(0)
13
+ end
14
+
15
+ require 'daemon_kit/generators'
16
+ require 'generators/daemon_kit/app/app_generator'
17
+
18
+ DaemonKit::Generators::AppGenerator.start
@@ -0,0 +1,2 @@
1
+ host: kennethkalmer@rubyforge.org
2
+ remote_dir: /var/www/gforge-projects/kit/daemon-kit/
@@ -0,0 +1,265 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{amqp-daemon-kit}
8
+ s.version = "0.1.8.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["kenneth.kalmer@gmail.com", "kenneth.kalmer@gmail.com"]
12
+ s.date = %q{2010-08-04}
13
+ s.default_executable = %q{daemon-kit}
14
+ s.description = %q{daemon-kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.}
15
+ s.email = %q{kenneth.kalmer@gmail.com}
16
+ s.executables = ["daemon-kit"]
17
+ s.extra_rdoc_files = [
18
+ "Configuration.txt",
19
+ "Deployment.txt",
20
+ "History.txt",
21
+ "Logging.txt",
22
+ "PostInstall.txt",
23
+ "README.rdoc",
24
+ "RuoteParticipants.txt",
25
+ "TODO.txt"
26
+ ]
27
+ s.files = [
28
+ ".gitignore",
29
+ "Configuration.txt",
30
+ "Deployment.txt",
31
+ "History.txt",
32
+ "Logging.txt",
33
+ "PostInstall.txt",
34
+ "README.rdoc",
35
+ "Rakefile",
36
+ "RuoteParticipants.txt",
37
+ "TODO.txt",
38
+ "bin/daemon-kit",
39
+ "config/website.yml",
40
+ "daemon-kit.gemspec",
41
+ "lib/daemon_kit.rb",
42
+ "lib/daemon_kit/abstract_logger.rb",
43
+ "lib/daemon_kit/application.rb",
44
+ "lib/daemon_kit/arguments.rb",
45
+ "lib/daemon_kit/commands/console.rb",
46
+ "lib/daemon_kit/commands/destroy.rb",
47
+ "lib/daemon_kit/commands/generate.rb",
48
+ "lib/daemon_kit/config.rb",
49
+ "lib/daemon_kit/console_daemon.rb",
50
+ "lib/daemon_kit/core_ext.rb",
51
+ "lib/daemon_kit/core_ext/configurable.rb",
52
+ "lib/daemon_kit/core_ext/string.rb",
53
+ "lib/daemon_kit/cron.rb",
54
+ "lib/daemon_kit/cucumber/world.rb",
55
+ "lib/daemon_kit/deployment/capistrano.rb",
56
+ "lib/daemon_kit/dk_amqp.rb",
57
+ "lib/daemon_kit/em.rb",
58
+ "lib/daemon_kit/error_handlers/base.rb",
59
+ "lib/daemon_kit/error_handlers/hoptoad.rb",
60
+ "lib/daemon_kit/exceptions.rb",
61
+ "lib/daemon_kit/generators.rb",
62
+ "lib/daemon_kit/generators/base.rb",
63
+ "lib/daemon_kit/initializer.rb",
64
+ "lib/daemon_kit/jabber.rb",
65
+ "lib/daemon_kit/nanite.rb",
66
+ "lib/daemon_kit/nanite/agent.rb",
67
+ "lib/daemon_kit/pid_file.rb",
68
+ "lib/daemon_kit/ruote_participants.rb",
69
+ "lib/daemon_kit/ruote_pseudo_participant.rb",
70
+ "lib/daemon_kit/ruote_workitem.rb",
71
+ "lib/daemon_kit/safety.rb",
72
+ "lib/daemon_kit/tasks.rb",
73
+ "lib/daemon_kit/tasks/environment.rake",
74
+ "lib/daemon_kit/tasks/framework.rake",
75
+ "lib/daemon_kit/tasks/god.rake",
76
+ "lib/daemon_kit/tasks/log.rake",
77
+ "lib/daemon_kit/tasks/monit.rake",
78
+ "lib/daemon_kit/vendor/thor-0.13.6/CHANGELOG.rdoc",
79
+ "lib/daemon_kit/vendor/thor-0.13.6/LICENSE",
80
+ "lib/daemon_kit/vendor/thor-0.13.6/README.rdoc",
81
+ "lib/daemon_kit/vendor/thor-0.13.6/Thorfile",
82
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor.rb",
83
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions.rb",
84
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/create_file.rb",
85
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/directory.rb",
86
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/empty_directory.rb",
87
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/file_manipulation.rb",
88
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/inject_into_file.rb",
89
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/base.rb",
90
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/file_binary_read.rb",
91
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/hash_with_indifferent_access.rb",
92
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/ordered_hash.rb",
93
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/error.rb",
94
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/group.rb",
95
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/invocation.rb",
96
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser.rb",
97
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/argument.rb",
98
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/arguments.rb",
99
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/option.rb",
100
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/options.rb",
101
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb",
102
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/runner.rb",
103
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell.rb",
104
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/basic.rb",
105
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/color.rb",
106
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/task.rb",
107
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/util.rb",
108
+ "lib/daemon_kit/vendor/thor-0.13.6/lib/thor/version.rb",
109
+ "lib/daemon_kit/xmpp.rb",
110
+ "lib/generators/daemon_kit/amqp/USAGE",
111
+ "lib/generators/daemon_kit/amqp/amqp_generator.rb",
112
+ "lib/generators/daemon_kit/amqp/templates/config/amqp.yml",
113
+ "lib/generators/daemon_kit/amqp/templates/config/pre-daemonize/amqp.rb",
114
+ "lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb",
115
+ "lib/generators/daemon_kit/app/USAGE",
116
+ "lib/generators/daemon_kit/app/app_generator.rb",
117
+ "lib/generators/daemon_kit/app/templates/Gemfile",
118
+ "lib/generators/daemon_kit/app/templates/README.tt",
119
+ "lib/generators/daemon_kit/app/templates/Rakefile",
120
+ "lib/generators/daemon_kit/app/templates/bin/daemon.tt",
121
+ "lib/generators/daemon_kit/app/templates/config/arguments.rb",
122
+ "lib/generators/daemon_kit/app/templates/config/boot.rb",
123
+ "lib/generators/daemon_kit/app/templates/config/environment.rb.tt",
124
+ "lib/generators/daemon_kit/app/templates/config/environments/development.rb",
125
+ "lib/generators/daemon_kit/app/templates/config/environments/production.rb",
126
+ "lib/generators/daemon_kit/app/templates/config/environments/test.rb",
127
+ "lib/generators/daemon_kit/app/templates/config/post-daemonize/readme",
128
+ "lib/generators/daemon_kit/app/templates/config/pre-daemonize/readme",
129
+ "lib/generators/daemon_kit/app/templates/lib/%app_name%.rb",
130
+ "lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb",
131
+ "lib/generators/daemon_kit/app/templates/script/console",
132
+ "lib/generators/daemon_kit/app/templates/script/destroy",
133
+ "lib/generators/daemon_kit/app/templates/script/generate",
134
+ "lib/generators/daemon_kit/capistrano/capistrano_generator.rb",
135
+ "lib/generators/daemon_kit/capistrano/templates/Capfile",
136
+ "lib/generators/daemon_kit/capistrano/templates/USAGE",
137
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt",
138
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy/logrotate.erb",
139
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt",
140
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt",
141
+ "lib/generators/daemon_kit/capistrano/templates/config/environments/staging.rb",
142
+ "lib/generators/daemon_kit/cron/USAGE",
143
+ "lib/generators/daemon_kit/cron/cron_generator.rb",
144
+ "lib/generators/daemon_kit/cron/templates/config/pre-daemonize/cron.rb",
145
+ "lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb",
146
+ "lib/generators/daemon_kit/cucumber/USAGE",
147
+ "lib/generators/daemon_kit/cucumber/cucumber_generator.rb",
148
+ "lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb",
149
+ "lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory",
150
+ "lib/generators/daemon_kit/cucumber/templates/features/support/env.rb",
151
+ "lib/generators/daemon_kit/cucumber/templates/script/cucumber",
152
+ "lib/generators/daemon_kit/cucumber/templates/tasks/cucumber.rake",
153
+ "lib/generators/daemon_kit/nanite_agent/USAGE",
154
+ "lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb",
155
+ "lib/generators/daemon_kit/nanite_agent/templates/config/nanite.yml",
156
+ "lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize/nanite_agent.rb",
157
+ "lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb",
158
+ "lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb",
159
+ "lib/generators/daemon_kit/rspec/USAGE",
160
+ "lib/generators/daemon_kit/rspec/rspec_generator.rb",
161
+ "lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb",
162
+ "lib/generators/daemon_kit/rspec/templates/spec/spec.opts",
163
+ "lib/generators/daemon_kit/rspec/templates/spec/spec_helper.rb",
164
+ "lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake",
165
+ "lib/generators/daemon_kit/ruote/USAGE",
166
+ "lib/generators/daemon_kit/ruote/ruote_generator.rb",
167
+ "lib/generators/daemon_kit/ruote/templates/config/amqp.yml",
168
+ "lib/generators/daemon_kit/ruote/templates/config/pre-daemonize/ruote.rb",
169
+ "lib/generators/daemon_kit/ruote/templates/config/ruote.yml",
170
+ "lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb",
171
+ "lib/generators/daemon_kit/ruote/templates/lib/sample.rb",
172
+ "lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb",
173
+ "lib/generators/daemon_kit/test_unit/USAGE",
174
+ "lib/generators/daemon_kit/test_unit/templates/tasks/test_unit.rake",
175
+ "lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt",
176
+ "lib/generators/daemon_kit/test_unit/templates/test/test_helper.rb",
177
+ "lib/generators/daemon_kit/test_unit/test_unit_generator.rb",
178
+ "lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb",
179
+ "lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml",
180
+ "lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb",
181
+ "lib/generators/daemon_kit/xmpp/xmpp_generator.rb",
182
+ "script/console",
183
+ "script/destroy",
184
+ "script/generate",
185
+ "script/txt2html",
186
+ "spec/abstract_logger_spec.rb",
187
+ "spec/argument_spec.rb",
188
+ "spec/config_spec.rb",
189
+ "spec/configurable_spec.rb",
190
+ "spec/daemon_kit_spec.rb",
191
+ "spec/error_handlers_spec.rb",
192
+ "spec/fixtures/env.yml",
193
+ "spec/fixtures/noenv.yml",
194
+ "spec/initializer_spec.rb",
195
+ "spec/spec.opts",
196
+ "spec/spec_helper.rb",
197
+ "tasks/cucumber.rake",
198
+ "tasks/rspec.rake",
199
+ "tasks/tests.rake",
200
+ "templates/god/god.erb",
201
+ "templates/monit/monit.erb",
202
+ "test/test_amqp_generator.rb",
203
+ "test/test_cron_generator.rb",
204
+ "test/test_daemon-kit_generator.rb",
205
+ "test/test_daemon_kit_config.rb",
206
+ "test/test_deploy_capistrano_generator.rb",
207
+ "test/test_generator_helper.rb",
208
+ "test/test_helper.rb",
209
+ "test/test_nanite_agent_generator.rb",
210
+ "test/test_ruote_generator.rb",
211
+ "test/test_test_unit_generator.rb"
212
+ ]
213
+ s.homepage = %q{http://github.com/kennethkalmer/daemon-kit}
214
+ s.post_install_message = %q{
215
+ For more information on daemon-kit, see http://kit.rubyforge.org/daemon-kit
216
+
217
+ To get started quickly run 'daemon-kit' without any arguments
218
+
219
+
220
+ }
221
+ s.rdoc_options = ["--charset=UTF-8"]
222
+ s.require_paths = ["lib"]
223
+ s.rubygems_version = %q{1.3.7}
224
+ s.summary = %q{Opinionated framework for Ruby daemons}
225
+ s.test_files = [
226
+ "spec/abstract_logger_spec.rb",
227
+ "spec/argument_spec.rb",
228
+ "spec/config_spec.rb",
229
+ "spec/configurable_spec.rb",
230
+ "spec/daemon_kit_spec.rb",
231
+ "spec/error_handlers_spec.rb",
232
+ "spec/initializer_spec.rb",
233
+ "spec/spec_helper.rb",
234
+ "test/test_amqp_generator.rb",
235
+ "test/test_cron_generator.rb",
236
+ "test/test_daemon-kit_generator.rb",
237
+ "test/test_daemon_kit_config.rb",
238
+ "test/test_deploy_capistrano_generator.rb",
239
+ "test/test_generator_helper.rb",
240
+ "test/test_helper.rb",
241
+ "test/test_nanite_agent_generator.rb",
242
+ "test/test_ruote_generator.rb",
243
+ "test/test_test_unit_generator.rb"
244
+ ]
245
+
246
+ if s.respond_to? :specification_version then
247
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
248
+ s.specification_version = 3
249
+
250
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
251
+ s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
252
+ s.add_development_dependency(%q<rspec>, [">= 0"])
253
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
254
+ else
255
+ s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
256
+ s.add_dependency(%q<rspec>, [">= 0"])
257
+ s.add_dependency(%q<cucumber>, [">= 0"])
258
+ end
259
+ else
260
+ s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
261
+ s.add_dependency(%q<rspec>, [">= 0"])
262
+ s.add_dependency(%q<cucumber>, [">= 0"])
263
+ end
264
+ end
265
+