explainer-rmb-rails 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -76
- data/Rakefile +3 -43
- data/VERSION +1 -1
- data/rmb-rails.gemspec +2 -12
- metadata +3 -13
data/README.rdoc
CHANGED
@@ -1,80 +1,6 @@
|
|
1
|
-
|
2
|
-
= rmb-rails: RESTful Message Beans for Ruby on Rails
|
1
|
+
= rmb-rails
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
During a lengthy career in software development, and later as an enterprise architect, I saw a lot of message broker deployments in many
|
7
|
-
large corporations. These systems were used primarily to knit together disparate computing 'silos' into a single fabric, as primarily
|
8
|
-
an integration tool. The implementations varied significantly, some were well engineered and managed, others were basket cases of
|
9
|
-
poor planning. One significant problem that was common in many of these deployments was the requirement to add broker subscriber
|
10
|
-
behavior inside existing applications. Many of these applications were single threaded (often written in COBOL) and had no real
|
11
|
-
ability to construct a thread to wait on some subscriber.receive method. This issue was resolved by a variety of means, many of
|
12
|
-
which involved polling the subscriber queue periodically, picking up some or all of the messages waiting, and processing them
|
13
|
-
through the application. Polling does not scale well. If the application had many worker instances, they all tended to compete
|
14
|
-
with one another and together, consumed a lot of CPU time in polling loops. If you slowed down the polling frequency, then you
|
15
|
-
got latency problems where messages sat in the queue when the readers were sleeping. The real solution was to construct some form
|
16
|
-
of subscriber adapter that could inject messages into the applications' standard incoming data stream. The Enterprise Java Message
|
17
|
-
Bean is a good example of this kind of adapter. Message arrival on a designated queue or topic caused the activation of a Message Bean
|
18
|
-
within the EJB container, allowing full participation in transactions within the container.
|
19
|
-
|
20
|
-
There is a real parallel between a Java EJB application and a Ruby-on-Rails application, and the Rails environment needs a method to
|
21
|
-
get incoming message broker subscriptions injected directly into the main Rails data stream. So, how can we convert an MQ message
|
22
|
-
into an http request? The rubygem rmb-rails addresses this issue.
|
23
|
-
|
24
|
-
= Theory of Operation
|
25
|
-
|
26
|
-
As stated above, experience shows that polling a queue to pick up messages waiting there does not scale well. I decided to create an
|
27
|
-
infrastructure where daemon processes, called listeners, can connect to a specified message broker, receive messages from that broker,
|
28
|
-
and then forward them on to a standard Rails controller using a standard Rails protocol. In other words, the daemon listener processes
|
29
|
-
act as browsers doing a form of file upload. The receiving rails controller is built on standard REST principles, and fits easily into
|
30
|
-
any Rails application.
|
31
|
-
|
32
|
-
= Component classes
|
33
|
-
|
34
|
-
* module RMB
|
35
|
-
The rmb-rails gem is packaged within a single module, called RMB. The component classes are described below. See the rdoc for each class for a full description.
|
36
|
-
* class RMB::Properties
|
37
|
-
The primary interface between the gem and the calling rails app consists of a multilevel hash. The hash is partially complete, but requires that several key value pairs be supplied.
|
38
|
-
* class RMB::ListenerClient
|
39
|
-
This class implements the interface between the calling application and the daemon listeners.
|
40
|
-
* class RMB::ListenerMain
|
41
|
-
This class, along with concrete Subscriber and Submitter subclasses, makes up the daemon listener process.
|
42
|
-
* class RMB::Subscriber
|
43
|
-
This is an abstract superclass for all Subscriber classes. Every daemon has an instance of a Subscriber class acting as the 'front end'
|
44
|
-
of the daemon, listening and blocking on the broker.
|
45
|
-
* class RMB::Submitter
|
46
|
-
This is an abstract superclass for all Submitter classes. Every daemon has an instance of a Submitter class acting as the
|
47
|
-
forwarding agent, taking messages received by the subscriber, packaging the message as an http request, and posts it to the specified controller/action pair.
|
48
|
-
* class RMB::StompSubscriber
|
49
|
-
This is a concrete subclass of Subscriber, which uses the Stomp protocol to listen to an ActiveMQ message broker.
|
50
|
-
* class RMB::MechanizeSubmitter
|
51
|
-
This is a concrete subclass of Submitter, which uses the WWW:Mechanize gem to package the message as a document and submit it to the controller.
|
52
|
-
|
53
|
-
= Installation
|
54
|
-
|
55
|
-
You will need an ActiveMQ message broker to use this gem. See http://activemq.apache.org/ for download and configuration instructions.
|
56
|
-
|
57
|
-
$ gem sources -a http://gems.github.com (you only have to do this once)
|
58
|
-
$ sudo gem install explainer-rmb-rails
|
59
|
-
|
60
|
-
or
|
61
|
-
|
62
|
-
$ sudo gem install rmb-rails (to get the same gem from rubyforge)
|
63
|
-
|
64
|
-
= Usage
|
65
|
-
|
66
|
-
Add the following require statement to your code to get access to this gem:
|
67
|
-
|
68
|
-
require 'rmb-rails'
|
69
|
-
|
70
|
-
Create an instance of RMB:ListenerClient to start/stop each listener daemon used. Get the
|
71
|
-
RESTful-Message-Beans(http://github.com/explainer/RESTful-Message-Beans/tree/master) rails app, which provides a complete
|
72
|
-
demo rails application using this gem.
|
73
|
-
|
74
|
-
== Credits
|
75
|
-
{ActiveMQ}[http://activemq.apache.org/]
|
76
|
-
{Enterprise Recipes with Ruby and Rails}[http://www.pragprog.com/titles/msenr/enterprise-recipes-with-ruby-and-rails]
|
77
|
-
{Jeweler gem}[http://technicalpickles.github.com/jeweler/]
|
3
|
+
Description goes here.
|
78
4
|
|
79
5
|
== Copyright
|
80
6
|
|
data/Rakefile
CHANGED
@@ -4,53 +4,13 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
|
8
|
-
gem.description = <<-EOF
|
9
|
-
...something interesting here...
|
10
|
-
EOF
|
11
|
-
|
12
7
|
gem.name = "rmb-rails"
|
13
8
|
gem.summary = %Q{RESTful Message Beans for Rails}
|
14
|
-
gem.email =
|
9
|
+
gem.email = "keburgett@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/explainer/rmb-rails"
|
15
11
|
gem.authors = ["Ken Burgett"]
|
12
|
+
gem.rubyforge_project = "rmb-rails"
|
16
13
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
-
|
18
|
-
gem.has_rdoc = true
|
19
|
-
gem.homepage = %q{http://github.com/explainer/rmb-rails}
|
20
|
-
gem.rdoc_options = ["--charset=UTF-8"]
|
21
|
-
gem.require_paths = ["lib"]
|
22
|
-
gem.rubyforge_project = %q{rmb-rails}
|
23
|
-
gem.rubygems_version = %q{1.3.1}
|
24
|
-
|
25
|
-
gem.add_dependency(%q<stomp>, [">= 1.1"])
|
26
|
-
gem.add_dependency(%q<mechanize>, ["= 0.9.2"])
|
27
|
-
gem.add_dependency(%q<daemons>, [">= 1.1.10"])
|
28
|
-
|
29
|
-
gem.files = [
|
30
|
-
".document",
|
31
|
-
".gitignore",
|
32
|
-
"LICENSE",
|
33
|
-
"README.rdoc",
|
34
|
-
"Rakefile",
|
35
|
-
"VERSION",
|
36
|
-
"lib/listener_client.rb",
|
37
|
-
"lib/listener_daemon.rb",
|
38
|
-
"lib/listener_daemon_control.rb",
|
39
|
-
"lib/listener_main.rb",
|
40
|
-
"lib/mechanize_submitter.rb",
|
41
|
-
"lib/rmb-rails.rb",
|
42
|
-
"lib/stomp_subscriber.rb",
|
43
|
-
"lib/submitter.rb",
|
44
|
-
"lib/subscriber.rb",
|
45
|
-
"rmb-rails.gemspec",
|
46
|
-
"test/rmb-rails_test.rb",
|
47
|
-
"test/test_helper.rb"
|
48
|
-
]
|
49
|
-
|
50
|
-
gem.extra_rdoc_files = [
|
51
|
-
"LICENSE",
|
52
|
-
"README.rdoc"
|
53
|
-
]
|
54
14
|
end
|
55
15
|
|
56
16
|
Jeweler::RubyforgeTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/rmb-rails.gemspec
CHANGED
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rmb-rails}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ken Burgett"]
|
9
|
-
s.date = %q{2009-07-
|
10
|
-
s.description = %q{...something interesting here...}
|
9
|
+
s.date = %q{2009-07-22}
|
11
10
|
s.email = %q{keburgett@gmail.com}
|
12
11
|
s.extra_rdoc_files = [
|
13
12
|
"LICENSE",
|
@@ -50,17 +49,8 @@ Gem::Specification.new do |s|
|
|
50
49
|
s.specification_version = 2
|
51
50
|
|
52
51
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_runtime_dependency(%q<stomp>, [">= 1.1"])
|
54
|
-
s.add_runtime_dependency(%q<mechanize>, ["= 0.9.2"])
|
55
|
-
s.add_runtime_dependency(%q<daemons>, [">= 1.1.10"])
|
56
52
|
else
|
57
|
-
s.add_dependency(%q<stomp>, [">= 1.1"])
|
58
|
-
s.add_dependency(%q<mechanize>, ["= 0.9.2"])
|
59
|
-
s.add_dependency(%q<daemons>, [">= 1.1.10"])
|
60
53
|
end
|
61
54
|
else
|
62
|
-
s.add_dependency(%q<stomp>, [">= 1.1"])
|
63
|
-
s.add_dependency(%q<mechanize>, ["= 0.9.2"])
|
64
|
-
s.add_dependency(%q<daemons>, [">= 1.1.10"])
|
65
55
|
end
|
66
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: explainer-rmb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Burgett
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,17 +32,7 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.9.2
|
34
34
|
version:
|
35
|
-
|
36
|
-
name: daemons
|
37
|
-
type: :runtime
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 1.1.10
|
44
|
-
version:
|
45
|
-
description: ...something interesting here...
|
35
|
+
description:
|
46
36
|
email: keburgett@gmail.com
|
47
37
|
executables: []
|
48
38
|
|