isimud 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.yardoc/checksums +15 -0
  6. data/.yardoc/object_types +0 -0
  7. data/.yardoc/objects/root.dat +0 -0
  8. data/.yardoc/proxy_types +0 -0
  9. data/Gemfile +23 -0
  10. data/Gemfile.lock +123 -0
  11. data/README.md +218 -0
  12. data/Rakefile +2 -0
  13. data/config.ru +7 -0
  14. data/config/tddium.yml +11 -0
  15. data/doc/Isimud.html +1696 -0
  16. data/doc/Isimud/BunnyClient.html +1004 -0
  17. data/doc/Isimud/Client.html +812 -0
  18. data/doc/Isimud/Event.html +1500 -0
  19. data/doc/Isimud/EventListener.html +1217 -0
  20. data/doc/Isimud/EventObserver.html +367 -0
  21. data/doc/Isimud/EventObserver/ClassMethods.html +292 -0
  22. data/doc/Isimud/Generators.html +117 -0
  23. data/doc/Isimud/Generators/ConfigGenerator.html +192 -0
  24. data/doc/Isimud/Generators/InitializerGenerator.html +192 -0
  25. data/doc/Isimud/Logging.html +230 -0
  26. data/doc/Isimud/ModelWatcher.html +312 -0
  27. data/doc/Isimud/ModelWatcher/ClassMethods.html +511 -0
  28. data/doc/Isimud/Railtie.html +123 -0
  29. data/doc/Isimud/TestClient.html +1003 -0
  30. data/doc/Isimud/TestClient/Queue.html +556 -0
  31. data/doc/_index.html +290 -0
  32. data/doc/class_list.html +58 -0
  33. data/doc/css/common.css +1 -0
  34. data/doc/css/full_list.css +57 -0
  35. data/doc/css/style.css +339 -0
  36. data/doc/file.README.html +338 -0
  37. data/doc/file_list.html +60 -0
  38. data/doc/frames.html +26 -0
  39. data/doc/index.html +338 -0
  40. data/doc/js/app.js +219 -0
  41. data/doc/js/full_list.js +181 -0
  42. data/doc/js/jquery.js +4 -0
  43. data/doc/method_list.html +711 -0
  44. data/doc/top-level-namespace.html +112 -0
  45. data/isimud.gemspec +25 -0
  46. data/lib/isimud.rb +91 -0
  47. data/lib/isimud/bunny_client.rb +95 -0
  48. data/lib/isimud/client.rb +48 -0
  49. data/lib/isimud/event.rb +112 -0
  50. data/lib/isimud/event_listener.rb +200 -0
  51. data/lib/isimud/event_observer.rb +81 -0
  52. data/lib/isimud/logging.rb +11 -0
  53. data/lib/isimud/model_watcher.rb +144 -0
  54. data/lib/isimud/railtie.rb +9 -0
  55. data/lib/isimud/tasks.rb +20 -0
  56. data/lib/isimud/test_client.rb +89 -0
  57. data/lib/isimud/version.rb +3 -0
  58. data/lib/rails/generators/isimud/config_generator.rb +12 -0
  59. data/lib/rails/generators/isimud/initializer_generator.rb +12 -0
  60. data/lib/rails/generators/isimud/templates/initializer.rb +17 -0
  61. data/lib/rails/generators/isimud/templates/isimud.yml +20 -0
  62. data/spec/internal/app/models/admin.rb +2 -0
  63. data/spec/internal/app/models/company.rb +34 -0
  64. data/spec/internal/app/models/user.rb +27 -0
  65. data/spec/internal/config/database.yml +3 -0
  66. data/spec/internal/config/routes.rb +3 -0
  67. data/spec/internal/db/schema.rb +22 -0
  68. data/spec/internal/log/.gitignore +1 -0
  69. data/spec/internal/public/favicon.ico +0 -0
  70. data/spec/isimud/bunny_client_spec.rb +125 -0
  71. data/spec/isimud/event_listener_spec.rb +86 -0
  72. data/spec/isimud/event_observer_spec.rb +32 -0
  73. data/spec/isimud/event_spec.rb +74 -0
  74. data/spec/isimud/model_watcher_spec.rb +189 -0
  75. data/spec/isimud/test_client_spec.rb +28 -0
  76. data/spec/isimud_spec.rb +49 -0
  77. data/spec/spec_helper.rb +55 -0
  78. metadata +195 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83a83137b7deb41a7c90543b1bc5e357f80f8b3d
4
+ data.tar.gz: afa7acb7b71b8cd159a7a9cfd95ed461613566ff
5
+ SHA512:
6
+ metadata.gz: 205e376894ca96ada6eb0859d24a619e98630e5d757cb30df84ff3674f8a378226778d16c1447956954c9d784f7ae5166782970ee6dff6e1dfcd8f6044426f22
7
+ data.tar.gz: 813394bb8976e04c1609a317d04c5e4054b868e6d85a83d53b5b67d6588dee2f4dc9b10c865c30b864e3f98ab12e17f4e9f828e287bdaa0586f186e3dbcf9ecf
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ InstalledFiles
6
+ coverage
7
+ lib/bundler/man
8
+ pkg
9
+ spec/reports
10
+ test/tmp
11
+ test/version_tmp
12
+ tmp
13
+ *.bundle
14
+ *.so
15
+ *.o
16
+ *.a
17
+ *.sqlite
18
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1 @@
1
+ 2.2.3
@@ -0,0 +1,15 @@
1
+ lib/isimud.rb 22ac8b1ab9a85d8ef39a68bd67f88712a6f0b77d
2
+ lib/isimud/event.rb 068adf31099eb773829921c85a446c2308d6750b
3
+ lib/isimud/tasks.rb 8d07d80e178928098e959ebdcbda1707e9b50617
4
+ lib/isimud/client.rb 80a360bd7a2817f7d3c67b33de8fd92f2610c5a8
5
+ lib/isimud/version.rb 39825e610d2f91209d7f98c086d8c3eb4f027b42
6
+ lib/isimud/logging.rb 2f506f049011441628a3d573d8e2a670156b4a3a
7
+ lib/isimud/railtie.rb e644c4d74ae8298f11dd0c2fcae1d72259e24ea3
8
+ lib/isimud/test_client.rb 4d3ab074ae617f47175384c742cd8acd6878718e
9
+ lib/isimud/bunny_client.rb f2e2cfdb7d9eaef1f38ebfc6d329cea849f4dc79
10
+ lib/isimud/model_watcher.rb f9294e03f6d22676ae59f07edabd16f028f7db79
11
+ lib/isimud/event_observer.rb b8d2861e876b58da8ed68c62e20883e5766e6f5e
12
+ lib/isimud/event_listener.rb 46f889072a1a19382aa45d38b599d2dbb6075225
13
+ lib/rails/generators/isimud/config_generator.rb d1c964f26c6e0f0289343bac17d3a9b1f99d7a98
14
+ lib/rails/generators/isimud/initializer_generator.rb c7b188459d17d35ccbfa820a434dd6a97a58aeeb
15
+ lib/rails/generators/isimud/templates/initializer.rb fb01711a9a3a523808f1f503a97342fb09bab4f8
Binary file
Binary file
Binary file
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in isimud.gemspec
4
+ gemspec
5
+
6
+ gem 'activesupport', '~> 3.2.17'
7
+ gem 'bundler', '~> 1.6'
8
+ gem 'rake'
9
+
10
+ group :development, :test do
11
+ gem 'awesome_print'
12
+ gem 'rspec'
13
+ gem 'combustion'
14
+ gem 'database_cleaner'
15
+ gem 'sqlite3'
16
+ gem 'codeclimate-test-reporter', require: false
17
+ end
18
+
19
+ group :test do
20
+ gem 'test_after_commit'
21
+ gem 'timecop'
22
+ end
23
+
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ isimud (0.5.2)
5
+ activerecord (>= 3.2.17)
6
+ activesupport (>= 3.2.17)
7
+ bunny (>= 1.6.0)
8
+ chronic_duration (>= 0.10.6)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionpack (3.2.21)
14
+ activemodel (= 3.2.21)
15
+ activesupport (= 3.2.21)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.21)
24
+ activesupport (= 3.2.21)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.21)
27
+ activemodel (= 3.2.21)
28
+ activesupport (= 3.2.21)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activesupport (3.2.21)
32
+ i18n (~> 0.6, >= 0.6.4)
33
+ multi_json (~> 1.0)
34
+ amq-protocol (2.0.0)
35
+ arel (3.0.3)
36
+ awesome_print (1.2.0)
37
+ builder (3.0.4)
38
+ bunny (2.1.0)
39
+ amq-protocol (>= 2.0.0)
40
+ chronic_duration (0.10.6)
41
+ numerizer (~> 0.1.1)
42
+ codeclimate-test-reporter (0.4.5)
43
+ simplecov (>= 0.7.1, < 1.0.0)
44
+ combustion (0.5.2)
45
+ activesupport (>= 3.0.0)
46
+ railties (>= 3.0.0)
47
+ thor (>= 0.14.6)
48
+ database_cleaner (1.4.0)
49
+ diff-lcs (1.2.5)
50
+ docile (1.1.5)
51
+ erubis (2.7.0)
52
+ hike (1.2.3)
53
+ i18n (0.7.0)
54
+ journey (1.0.4)
55
+ json (1.8.2)
56
+ multi_json (1.10.1)
57
+ numerizer (0.1.1)
58
+ rack (1.4.5)
59
+ rack-cache (1.2)
60
+ rack (>= 0.4)
61
+ rack-ssl (1.3.4)
62
+ rack
63
+ rack-test (0.6.3)
64
+ rack (>= 1.0)
65
+ railties (3.2.21)
66
+ actionpack (= 3.2.21)
67
+ activesupport (= 3.2.21)
68
+ rack-ssl (~> 1.3.2)
69
+ rake (>= 0.8.7)
70
+ rdoc (~> 3.4)
71
+ thor (>= 0.14.6, < 2.0)
72
+ rake (10.4.2)
73
+ rdoc (3.12.2)
74
+ json (~> 1.4)
75
+ rspec (3.1.0)
76
+ rspec-core (~> 3.1.0)
77
+ rspec-expectations (~> 3.1.0)
78
+ rspec-mocks (~> 3.1.0)
79
+ rspec-core (3.1.7)
80
+ rspec-support (~> 3.1.0)
81
+ rspec-expectations (3.1.2)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.1.0)
84
+ rspec-mocks (3.1.3)
85
+ rspec-support (~> 3.1.0)
86
+ rspec-support (3.1.2)
87
+ simplecov (0.9.1)
88
+ docile (~> 1.1.0)
89
+ multi_json (~> 1.0)
90
+ simplecov-html (~> 0.8.0)
91
+ simplecov-html (0.8.0)
92
+ sprockets (2.2.3)
93
+ hike (~> 1.2)
94
+ multi_json (~> 1.0)
95
+ rack (~> 1.0)
96
+ tilt (~> 1.1, != 1.3.0)
97
+ sqlite3 (1.3.10)
98
+ test_after_commit (0.4.0)
99
+ activerecord (>= 3.2)
100
+ thor (0.19.1)
101
+ tilt (1.4.1)
102
+ timecop (0.7.1)
103
+ tzinfo (0.3.42)
104
+
105
+ PLATFORMS
106
+ ruby
107
+
108
+ DEPENDENCIES
109
+ activesupport (~> 3.2.17)
110
+ awesome_print
111
+ bundler (~> 1.6)
112
+ codeclimate-test-reporter
113
+ combustion
114
+ database_cleaner
115
+ isimud!
116
+ rake
117
+ rspec
118
+ sqlite3
119
+ test_after_commit
120
+ timecop
121
+
122
+ BUNDLED WITH
123
+ 1.10.6
@@ -0,0 +1,218 @@
1
+ # Isimud: AMQP based Messaging abstraction component.
2
+
3
+ >Isimud is a minor god, the messenger of the god Enki in Sumerian mythology.
4
+ >He is readily identifiable by the fact that he possesses two faces looking in opposite directions.
5
+ >
6
+ >*Source: Wikipedia*
7
+
8
+ Isimud is a message publishing and consumption gem. It consists of the following components:
9
+
10
+ * A [Bunny](http://rubybunny.info) based client interface for publishing and receiving messages using AMQP.
11
+ * A test client which mocks most client operations and allows for synchronous delivery and processing of messages for unit tests.
12
+ * A Model Watcher mixin for ActiveRecord that automatically sends messages whenever an ActiveRecord instance is created, modified, or destroyed.
13
+ * An Event Observer mixin for registering ActiveRecord models and instances with the EventListener for receiving messages.
14
+ * An Event Listener daemon process which manages queues for Event Observers.
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ gem 'isimud'
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install isimud
29
+
30
+ For Rails applications, use the following generators to create config and initializer files, respectively:
31
+
32
+ $ rails g isimud:config
33
+ $ rails g isimud:initializer
34
+
35
+ Customize the AMQP broker settings in the config/isimud.yml
36
+
37
+ ## Usage
38
+
39
+ ### Connecting to an AMQP server
40
+
41
+ There are two supported conventions for specifying a RabbitMQ server (broker) in the configuration file:
42
+
43
+ #### Using a URL
44
+
45
+ server: amqp:port//user_name:password@host/vhost
46
+
47
+ #### Using separate parameters:
48
+
49
+ server:
50
+ host: hostname
51
+ port: 15672
52
+ user: user_name
53
+ pass: password
54
+ vhost: vhost
55
+
56
+ [Complete list of Bunny options available here](http://rubybunny.info/articles/connecting.html)
57
+
58
+ Isimud is designed to work with [RabbitMQ](http://www.rabbitmq.com).
59
+ Besides the standard AMQP 0.9.1 protocol, Isimud relies on Publishing Confirms (Acknowledgements), which
60
+ is a RabbitMQ specific extension to AMQP 0.9.1.
61
+
62
+ Note that Isimud does not automatically create exchanges. Make sure the exchange has been declared on the
63
+ message server, or you will get an exception. It is highly recommended to set the /durable/ parameter on the exchange
64
+ in order to prevent loss of messages due to failures.
65
+
66
+ Isimud uses [Bunny](http://rubybunny.info) to connect to RabbitMQ.
67
+
68
+ ### Message publication
69
+
70
+ Isimud uses topic based exchanges publish messages. This allows for multiple listener
71
+ workers to operate in parallel to process messages.
72
+
73
+ ### Message binding and consumption
74
+
75
+ Isimud uses non-exclusive, durable queues to listen for and consume messages. Named queues are automatically created
76
+ if they do not exist.
77
+
78
+ ## Changes
79
+
80
+ ### 0.5.2
81
+
82
+ * Fixed regexp bug in TestClient affecting message delivery
83
+ * Add more logging for EventObserver binding
84
+
85
+ ### 0.5.1
86
+
87
+ * Added Event#attributes
88
+
89
+ ### 0.5.0
90
+
91
+ * Allow EventObserver classes to override the exchange for listening to events
92
+ * Corrected initialization of EventListener for handling defaults
93
+ * Create an explicit name for EventListener model queues for EventObserver instances
94
+ * Fixed a bug in EventObserver that caused ModelWatcher to not send update events appropriately when default columns are watched
95
+ * Moved requires for Isimud below config attribute declarations
96
+
97
+ ### 0.4.10
98
+
99
+ * Corrected trap of INT and TERM signals
100
+ * Added error counter mutex and cleaned up logging
101
+ * Corrected race condition for registering EventObserver classes
102
+
103
+ ### 0.4.5
104
+
105
+ * Fixed issues with exception handling
106
+
107
+ ### 0.4.1
108
+
109
+ * Event now accepts an exchange option for publishing
110
+ * Added Isimud.events_exchange
111
+ * Cleaned up initializer template
112
+
113
+ ### 0.4.0
114
+
115
+ * Event logging of published message now set to debug level
116
+ * Added EventListener and EventObserver
117
+ * Added new Client methods: create_queue, delete_queue. It is now possible to create queues with
118
+ customized options (such as exclusive, non-durable queues).
119
+ * Clients can now be configured with an exception handler. This is used by EventListener to intercept exceptions raised
120
+ during message handling by an observer.
121
+
122
+ ### 0.3.7
123
+
124
+ * Added EventObserver mix-in
125
+ * Added accessors for queues and routing_keys to TestClient
126
+
127
+ ### 0.3.6
128
+
129
+ * Reraise all exceptions in message processing block in BunnyClient#bind.
130
+
131
+ ### 0.3.5
132
+
133
+ * Fixed deprecation on setting manual ack on Bunny queue subscriptions.
134
+
135
+ ### 0.3.4
136
+
137
+ * Catch Timeout::Error in ModelWatcher.synchronize
138
+
139
+ ### 0.3.1
140
+
141
+ * Tuning gargabe collector on ModelWatcher.synchronize
142
+
143
+ ### 0.3.0
144
+
145
+ * Added rake task for manual synchronization using ModelWatcher
146
+
147
+ ### 0.2.17
148
+
149
+ * Added guard on null #updated_at instances
150
+ * Added ModelWatcher#isimud_sync for manual synchronization
151
+
152
+ ### 0.2.15
153
+
154
+ * Changed Event#send to Event#publish, to avoid overloading Ruby.
155
+
156
+ ### 0.2.13
157
+
158
+ * Add :omit_parameters option to Event#as_json
159
+
160
+ ### 0.2.12
161
+
162
+ * Demodulize ActiveRecord model name when setting ModelWatcher event type
163
+
164
+ ### 0.2.10
165
+
166
+ * Added Isimud.retry_failures
167
+ * Isimud::ModelWatcher now includes :created_at and :updated_at columns by default
168
+ * Added Isimud::Client.connected?
169
+ * Avoid connecting to database when Isimud::ModelWatcher.watch_attributes is called
170
+
171
+ ### 0.2.4
172
+
173
+ * Add Isimud::ModelWatcher#isimud_synchronize? to allow conditional synchronization. Override to activate.
174
+
175
+ ### 0.2.2
176
+
177
+ * Add enable_model_watcher configuration parameter (default is true)
178
+
179
+ ### 0.2.0
180
+
181
+ * Added Isimud::Event
182
+ * Extracted Isimud::Client#log into Isimud::Logging module
183
+
184
+ ### 0.1.4
185
+
186
+ * Don't reject messages when exception is raised in bind block
187
+
188
+ ### 0.1.3
189
+
190
+ * Upgrade bunny gem requirement to 1.3.x
191
+ * Fixed message acknowledgements
192
+ * Added log_level configuration parameter (default is :debug)
193
+
194
+ ### 0.1.2
195
+
196
+ * Reject message with requeue when an exception is raised during processing
197
+
198
+ ### 0.1.1
199
+
200
+ * Enable channel confirmations for message publication
201
+
202
+ ### 0.1.0
203
+
204
+ * ModelWatcher mix-in for ActiveRecord, sends events on instance changes
205
+ * Initializer generator for Rails
206
+
207
+ ### 0.0.8 (first working version)
208
+
209
+ * Don't clear the queues when reconnecting TestClient
210
+
211
+
212
+ ## Contributing
213
+
214
+ 1. Fork it ( https://github.com/KeasInc/isimud/fork )
215
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
216
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
217
+ 4. Push to the branch (`git push origin my-new-feature`)
218
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ Bundler.require :default, :development
5
+
6
+ Combustion.initialize!
7
+ run Combustion::Application
@@ -0,0 +1,11 @@
1
+ ---
2
+ :tddium:
3
+ :ruby_version: ruby-1.9.3-p547
4
+ :bundler_version: 1.6
5
+ :mysql:
6
+ :version: '5.6'
7
+ :sqlite: false
8
+ :rabbitmq: true
9
+ :test_pattern:
10
+ - spec/**_spec.rb
11
+ :timeout_hook: 1200