serf 0.0.0.alpha → 0.1.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -8
- data/Gemfile.lock +56 -0
- data/LICENSE.txt +202 -20
- data/NOTICE.txt +4 -0
- data/README.md +101 -0
- data/Rakefile +4 -2
- data/bin/serfup +9 -0
- data/examples/config.su +58 -0
- data/lib/serf.rb +21 -0
- data/lib/serf/builder.rb +98 -0
- data/lib/serf/emitters/redis_emitter.rb +23 -0
- data/lib/serf/middleware/celluloid_runner.rb +45 -0
- data/lib/serf/middleware/em_runner.rb +32 -0
- data/lib/serf/middleware/kind_mapper.rb +48 -0
- data/lib/serf/null_object.rb +13 -0
- data/lib/serf/receivers/msgpack_receiver.rb +55 -0
- data/lib/serf/receivers/redis_pubsub_receiver.rb +38 -0
- data/lib/serf/version.rb +11 -0
- data/serf.gemspec +105 -0
- metadata +143 -18
- data/README.rdoc +0 -19
data/Gemfile
CHANGED
@@ -1,14 +1,27 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
|
-
# gem
|
4
|
+
# gem 'activesupport', '>= 2.3.5'
|
5
|
+
|
6
|
+
gem 'activesupport', '~> 3.1.1'
|
7
|
+
gem 'eventmachine', '~> 0.12.10'
|
8
|
+
gem 'i18n', '~> 0.6.0'
|
9
|
+
gem 'msgpack', '~> 0.4.6'
|
10
|
+
gem 'msgpack-rpc', '~> 0.4.5'
|
11
|
+
gem 'multi_json', '~> 1.0.3'
|
12
|
+
gem 'rack', '~> 1.3.5'
|
13
|
+
gem 'redis', '~> 2.2.2'
|
5
14
|
|
6
15
|
# Add dependencies to develop your gem here.
|
7
16
|
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
17
|
+
group :development, :test do
|
18
|
+
gem 'rspec', '~> 2.3.0'
|
19
|
+
gem 'yard', '~> 0.6.0'
|
20
|
+
gem 'bundler', '~> 1.0.0'
|
21
|
+
gem 'jeweler', '~> 1.6.4'
|
22
|
+
gem 'rcov', '>= 0'
|
23
|
+
|
24
|
+
# Soft Dependencies
|
25
|
+
gem 'log4r', '~> 1.1.9'
|
26
|
+
gem 'celluloid', '~> 0.5.0' # Only for CelluloidRunner
|
14
27
|
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.1.1)
|
5
|
+
multi_json (~> 1.0)
|
6
|
+
celluloid (0.5.0)
|
7
|
+
diff-lcs (1.1.3)
|
8
|
+
eventmachine (0.12.10)
|
9
|
+
git (1.2.5)
|
10
|
+
i18n (0.6.0)
|
11
|
+
iobuffer (1.0.0)
|
12
|
+
jeweler (1.6.4)
|
13
|
+
bundler (~> 1.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rake
|
16
|
+
log4r (1.1.9)
|
17
|
+
msgpack (0.4.6)
|
18
|
+
msgpack-rpc (0.4.5)
|
19
|
+
msgpack (>= 0.4.4)
|
20
|
+
rev (>= 0.3.0)
|
21
|
+
multi_json (1.0.3)
|
22
|
+
rack (1.3.5)
|
23
|
+
rake (0.9.2.2)
|
24
|
+
rcov (0.9.11)
|
25
|
+
redis (2.2.2)
|
26
|
+
rev (0.3.2)
|
27
|
+
iobuffer (>= 0.1.3)
|
28
|
+
rspec (2.3.0)
|
29
|
+
rspec-core (~> 2.3.0)
|
30
|
+
rspec-expectations (~> 2.3.0)
|
31
|
+
rspec-mocks (~> 2.3.0)
|
32
|
+
rspec-core (2.3.1)
|
33
|
+
rspec-expectations (2.3.0)
|
34
|
+
diff-lcs (~> 1.1.2)
|
35
|
+
rspec-mocks (2.3.0)
|
36
|
+
yard (0.6.8)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
activesupport (~> 3.1.1)
|
43
|
+
bundler (~> 1.0.0)
|
44
|
+
celluloid (~> 0.5.0)
|
45
|
+
eventmachine (~> 0.12.10)
|
46
|
+
i18n (~> 0.6.0)
|
47
|
+
jeweler (~> 1.6.4)
|
48
|
+
log4r (~> 1.1.9)
|
49
|
+
msgpack (~> 0.4.6)
|
50
|
+
msgpack-rpc (~> 0.4.5)
|
51
|
+
multi_json (~> 1.0.3)
|
52
|
+
rack (~> 1.3.5)
|
53
|
+
rcov
|
54
|
+
redis (~> 2.2.2)
|
55
|
+
rspec (~> 2.3.0)
|
56
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,202 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/NOTICE.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
serf
|
2
|
+
====
|
3
|
+
|
4
|
+
Serf is a library that scaffolds distributed systems that are architected using
|
5
|
+
Event-Driven Service Oriented Architecture design in combinations with
|
6
|
+
the Command Query Responsibility Separation pattern.
|
7
|
+
|
8
|
+
Fundamentally, serf is a server process that receives commands and
|
9
|
+
emits events. The actual business logic is set up using `Serf's Up`
|
10
|
+
configuration files similar to rackup files.
|
11
|
+
|
12
|
+
An application developer writes Handler code that knows how to
|
13
|
+
process commands and events. This handler code is wired up in the
|
14
|
+
afore mentioned serfup file.
|
15
|
+
|
16
|
+
Handler code is essentally an object that responds to 'call' as with
|
17
|
+
other Rack based applications. The primary difference is that
|
18
|
+
the 'env' passed to the Handler object is NOT rack env conformant.
|
19
|
+
|
20
|
+
The message passed to the Handler objects' call methods are a
|
21
|
+
hash, which has a `kind` keyed element whose value is the type
|
22
|
+
of command (or event). A Handler SHOULD verify that this value is
|
23
|
+
what it expects in case of misrouting due to bad serfup configuration.
|
24
|
+
|
25
|
+
The serf library provides a very basic event service bus using
|
26
|
+
Redis' pubsub capabilities. We hope to implement more advanced topologies
|
27
|
+
using ZeroMQ in the future.
|
28
|
+
|
29
|
+
View the `examples/config.su` file for an example of a serfup configuration.
|
30
|
+
|
31
|
+
Besides Handlers, we have `Receivers` that expose points of entry for
|
32
|
+
command and event messages. We implement two types:
|
33
|
+
|
34
|
+
1. RedisPubsubReceiver - For pubsub event messages.
|
35
|
+
2. MsgpackReceiver - For msgpack rpc receipt of command messages.
|
36
|
+
|
37
|
+
Middleware
|
38
|
+
==========
|
39
|
+
|
40
|
+
Serf::Middleware::EmRunner
|
41
|
+
--------------------------
|
42
|
+
|
43
|
+
The EmRunner middleware is a mechanism to take a received message
|
44
|
+
(from RedisPubsubReceiver or MsgpackReceiver) and have the subsequent
|
45
|
+
app chain to be processed in the EventMachine deferred thread pool.
|
46
|
+
This is handy for async messages that come in through the PubSub
|
47
|
+
channel. And it is helpful in the CQRS model of processing when
|
48
|
+
accepting commands through Msgpack RPC.
|
49
|
+
|
50
|
+
Serf::Middleware::CelluloidRunner
|
51
|
+
---------------------------------
|
52
|
+
|
53
|
+
`celluloid` is a soft dependency.
|
54
|
+
|
55
|
+
But this middleware functions the same as the EmRunner, but with
|
56
|
+
actors and fibers instead.
|
57
|
+
|
58
|
+
NOTE: The limitation of this is that only 1 actor will be generated
|
59
|
+
per 'use Serf::Middleware::CelluloidRunner' definition. Thus messages
|
60
|
+
to any handler within a single 'group' will be processed serially.
|
61
|
+
|
62
|
+
This might be helpful in special cases where you want non-blocking
|
63
|
+
receipt of messages but also want ordered processing based on
|
64
|
+
received messages.
|
65
|
+
|
66
|
+
Airbrake
|
67
|
+
--------
|
68
|
+
|
69
|
+
You can use Airbrake's middleware to catch exceptions.
|
70
|
+
|
71
|
+
# example.su
|
72
|
+
require 'rack'
|
73
|
+
require 'airbrake'
|
74
|
+
|
75
|
+
Airbrake.configure do |config|
|
76
|
+
config.api_key = 'my_api_key'
|
77
|
+
end
|
78
|
+
|
79
|
+
group :my_commands do
|
80
|
+
use Airbrake::Rack
|
81
|
+
handle 'my_command', MyCommand.new
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
Contributing to serf
|
86
|
+
====================
|
87
|
+
|
88
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
89
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
90
|
+
* Fork the project
|
91
|
+
* Start a feature/bugfix branch
|
92
|
+
* Commit and push until you are happy with your contribution
|
93
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
94
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
95
|
+
|
96
|
+
|
97
|
+
Copyright
|
98
|
+
=========
|
99
|
+
|
100
|
+
Copyright (c) 2011 Benjamin Yu. See LICENSE.txt for further details.
|
101
|
+
|
data/Rakefile
CHANGED
@@ -12,15 +12,17 @@ end
|
|
12
12
|
require 'rake'
|
13
13
|
|
14
14
|
require 'jeweler'
|
15
|
+
require './lib/serf/version.rb'
|
15
16
|
Jeweler::Tasks.new do |gem|
|
16
17
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
18
|
gem.name = "serf"
|
18
19
|
gem.homepage = "http://github.com/byu/serf"
|
19
20
|
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{
|
21
|
-
gem.description = %Q{
|
21
|
+
gem.summary = %Q{Event-Driven SOA with CQRS}
|
22
|
+
gem.description = %Q{Event-Driven SOA with CQRS}
|
22
23
|
gem.email = "benjaminlyu@gmail.com"
|
23
24
|
gem.authors = ["Benjamin Yu"]
|
25
|
+
gem.version = Serf::Version::STRING
|
24
26
|
# dependencies defined in Gemfile
|
25
27
|
end
|
26
28
|
Jeweler::RubygemsDotOrgTasks.new
|
data/bin/serfup
ADDED
data/examples/config.su
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# A Serf's Up file
|
2
|
+
|
3
|
+
require 'log4r'
|
4
|
+
|
5
|
+
# Set up a general logger for the app
|
6
|
+
logger = Log4r::Logger.new 'my_logger'
|
7
|
+
logger.outputters = Log4r::FileOutputter.new(
|
8
|
+
'fileOutputter',
|
9
|
+
filename: 'console.txt')
|
10
|
+
|
11
|
+
# Define a single emitter w/ default redis connections
|
12
|
+
emitter = Serf::RedisEmitter.new
|
13
|
+
|
14
|
+
# Define a group of events handlers
|
15
|
+
group :events do
|
16
|
+
# We use the EmRunner middleware so the handlers get run in the
|
17
|
+
# EventMachine deferred thread pool.
|
18
|
+
use Serf::Middleware::EmRunner, logger: logger
|
19
|
+
|
20
|
+
# Define a handler for the post_rated_event kind of message.
|
21
|
+
handle 'post_rated_event', proc { |env|
|
22
|
+
logger.info("I'm in post_rated_event #{env.inspect}")
|
23
|
+
[200, {}, '']
|
24
|
+
}
|
25
|
+
|
26
|
+
# Define what happens if a message received has a 'kind' attribute that
|
27
|
+
# is not defined in this group.
|
28
|
+
not_found(proc { |env|
|
29
|
+
logger.info("event not found #{env.inspect}")
|
30
|
+
[200, {},'']
|
31
|
+
})
|
32
|
+
end
|
33
|
+
|
34
|
+
# Define a group of handlers that'll be handled by the MsgPackReceiver
|
35
|
+
group :commands do
|
36
|
+
# We use the EmRunner middleware so the handlers get run in the
|
37
|
+
# EventMachine deferred thread pool.
|
38
|
+
use Serf::Middleware::EmRunner, logger: logger
|
39
|
+
|
40
|
+
# Handle the 'post_rating_request' command message.
|
41
|
+
handle 'post_rating_request', proc { |env|
|
42
|
+
logger.info("I'm in post_rating_request #{env.inspect}")
|
43
|
+
emitter.emit(
|
44
|
+
kind: 'post_rated_event',
|
45
|
+
rated_data: env.to_s)
|
46
|
+
[200, {},'']
|
47
|
+
}
|
48
|
+
not_found(proc { |env|
|
49
|
+
logger.info("command not found #{env.inspect}")
|
50
|
+
[200, {},'']
|
51
|
+
})
|
52
|
+
end
|
53
|
+
|
54
|
+
# Bind our receivers and handler groups
|
55
|
+
bind :events, Serf::RedisPubsubReceiver
|
56
|
+
bind :commands, Serf::MsgpackReceiver, :host => '0.0.0.0', :post => 18800
|
57
|
+
|
58
|
+
|
data/lib/serf.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Serf
|
2
|
+
|
3
|
+
autoload :Builder, 'serf/builder'
|
4
|
+
autoload :NullObject, 'serf/null_object'
|
5
|
+
|
6
|
+
# Emitters
|
7
|
+
autoload :RedisEmitter, 'serf/emitters/redis_emitter'
|
8
|
+
|
9
|
+
# Receivers
|
10
|
+
autoload :MsgpackReceiver, 'serf/receivers/msgpack_receiver'
|
11
|
+
autoload :RedisPubsubReceiver, 'serf/receivers/redis_pubsub_receiver'
|
12
|
+
|
13
|
+
module Middleware
|
14
|
+
autoload :CelluloidRunner, 'serf/middleware/celluloid_runner'
|
15
|
+
autoload :EmRunner, 'serf/middleware/em_runner'
|
16
|
+
autoload :KindMapper, 'serf/middleware/kind_mapper'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'serf/version'
|
data/lib/serf/builder.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
module Serf
|
4
|
+
|
5
|
+
##
|
6
|
+
# A Serf Builder that processes the SerfUp DSL to set up a new
|
7
|
+
# serf server processing.
|
8
|
+
#
|
9
|
+
# builder = Serf::Builder.parse_file 'examples/config.su'
|
10
|
+
# builder.run # spins of daemon threads for each receiver
|
11
|
+
# EventMachine::run # Most likely do this because of EmRunner middleware.
|
12
|
+
#
|
13
|
+
# or
|
14
|
+
#
|
15
|
+
# builder = Serf::Builder.new do
|
16
|
+
# ... A SerfUp Config block here. See the examples/config.su
|
17
|
+
# end
|
18
|
+
# builder.run
|
19
|
+
# EventMachine::run
|
20
|
+
#
|
21
|
+
class Builder
|
22
|
+
def self.parse_file(config)
|
23
|
+
cfgfile = ::File.read(config)
|
24
|
+
builder = eval "::Serf::Builder.new {\n" + cfgfile + "\n}",
|
25
|
+
TOPLEVEL_BINDING, config
|
26
|
+
return builder
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(&block)
|
30
|
+
@already_run = false
|
31
|
+
@groups = {}
|
32
|
+
@receivers = []
|
33
|
+
|
34
|
+
reset_current_group
|
35
|
+
instance_eval(&block) if block_given?
|
36
|
+
end
|
37
|
+
|
38
|
+
def group(name, &block)
|
39
|
+
raise 'Already inside group' if @current_group_name
|
40
|
+
@current_group_name = name
|
41
|
+
instance_eval(&block) if block_given?
|
42
|
+
commit_current_group
|
43
|
+
reset_current_group
|
44
|
+
end
|
45
|
+
|
46
|
+
def use(middleware, *args, &block)
|
47
|
+
@use << proc { |app| middleware.new(app, *args, &block) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def handle(kind, app=nil, &block)
|
51
|
+
raise 'Not inside group' unless @current_group_name
|
52
|
+
if app
|
53
|
+
@handlers[kind.to_s] = app
|
54
|
+
elsif block_given?
|
55
|
+
@handlers[kind.to_s] = ::Rack::Builder.new(block).to_app
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def not_found(app)
|
60
|
+
raise 'not_found already declared for this group' if @not_found
|
61
|
+
@not_found = app
|
62
|
+
end
|
63
|
+
|
64
|
+
def bind(group, receiver, *args)
|
65
|
+
app = @groups[group]
|
66
|
+
@receivers << receiver.new(app, *args)
|
67
|
+
end
|
68
|
+
|
69
|
+
def run
|
70
|
+
raise 'Already run' if @already_run
|
71
|
+
@already_run = true
|
72
|
+
@receivers.each do |receiver|
|
73
|
+
Thread.new {
|
74
|
+
receiver.run
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def reset_current_group
|
82
|
+
@current_group_name = nil
|
83
|
+
@not_found = nil
|
84
|
+
@handlers = {}
|
85
|
+
@use = []
|
86
|
+
end
|
87
|
+
|
88
|
+
def commit_current_group
|
89
|
+
app = ::Serf::Middleware::KindMapper.new(
|
90
|
+
map: @handlers,
|
91
|
+
not_found: @not_found)
|
92
|
+
app = @use.reverse.inject(app) { |a,e| e[a] } if @use.size > 0
|
93
|
+
@groups[@current_group_name] = app
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
require 'redis'
|
3
|
+
|
4
|
+
module Serf
|
5
|
+
|
6
|
+
##
|
7
|
+
# Emits messages/events over a redis pubsub channel.
|
8
|
+
#
|
9
|
+
class RedisEmitter
|
10
|
+
DEFAULT_CHANNEL = 'serf_pubsub_channel'
|
11
|
+
|
12
|
+
def initialize(options={})
|
13
|
+
@redis = options.fetch(:redis) { Redis.connect }
|
14
|
+
@channel = options.fetch(:channel) { DEFAULT_CHANNEL }
|
15
|
+
end
|
16
|
+
|
17
|
+
def emit(message)
|
18
|
+
encoded_message = MultiJson.encode message
|
19
|
+
@redis.publish @channel, encoded_message
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'celluloid'
|
2
|
+
|
3
|
+
module Serf
|
4
|
+
module Middleware
|
5
|
+
|
6
|
+
##
|
7
|
+
# Spins off a received message to be run async by a celluloid actor.
|
8
|
+
#
|
9
|
+
class CelluloidRunner
|
10
|
+
|
11
|
+
def initialize(app, options={})
|
12
|
+
actor_class = options.fetch(:actor_class) { CelluloidRunnerActor }
|
13
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
14
|
+
@actor = actor_class.new app, logger: @logger
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(message)
|
18
|
+
@actor.call! message
|
19
|
+
return [
|
20
|
+
202,
|
21
|
+
{
|
22
|
+
'Content-Type' => 'text/plain'
|
23
|
+
},
|
24
|
+
['Accepted']
|
25
|
+
]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class CelluloidRunnerActor
|
30
|
+
include Celluloid
|
31
|
+
|
32
|
+
def initialize(app, options={})
|
33
|
+
@app = app
|
34
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
35
|
+
end
|
36
|
+
|
37
|
+
def call(message)
|
38
|
+
@app.call message
|
39
|
+
rescue => e
|
40
|
+
@logger.error e
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'eventmachine'
|
2
|
+
|
3
|
+
module Serf
|
4
|
+
module Middleware
|
5
|
+
|
6
|
+
class EmRunner
|
7
|
+
def initialize(app, options={})
|
8
|
+
@em = options.fetch(:event_machine) { EM }
|
9
|
+
@app = app
|
10
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
@em.defer(proc do
|
15
|
+
begin
|
16
|
+
@app.call env
|
17
|
+
rescue => e
|
18
|
+
@logger.error e
|
19
|
+
end
|
20
|
+
end)
|
21
|
+
return [
|
22
|
+
202,
|
23
|
+
{
|
24
|
+
'Content-Type' => 'text/plain'
|
25
|
+
},
|
26
|
+
['Accepted']
|
27
|
+
]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Serf
|
2
|
+
module Middleware
|
3
|
+
|
4
|
+
##
|
5
|
+
# Our "router" app that will call the actual registered handler object
|
6
|
+
# with the received message based on the 'kind' of message received.
|
7
|
+
#
|
8
|
+
# This means we look into the 'env' of the call and match the
|
9
|
+
# env['kind'] value to see if we have it registered.
|
10
|
+
# If found, we pass to the proper handler, else we run a not_found
|
11
|
+
# handler. Sans a registered not_found handler, we just return a
|
12
|
+
# 404 message. Note that if we used any Async middleware (i.e.
|
13
|
+
# EmRunner or CelluloidRunner), the calling client (using Msgpack RPC)
|
14
|
+
# will not see the 404 or not found handler results. The Async middleware
|
15
|
+
# will have returned a 202 Accepted result.
|
16
|
+
#
|
17
|
+
# Developers SHOULD implement alternate mechanisms of error handling
|
18
|
+
# and logging. Even possibly implementing a 404 handler that
|
19
|
+
# broadcasts such a not found error event message.
|
20
|
+
#
|
21
|
+
class KindMapper
|
22
|
+
|
23
|
+
def initialize(options={})
|
24
|
+
@map = options.fetch(:map) { {} }
|
25
|
+
@not_found = options[:not_found]
|
26
|
+
end
|
27
|
+
|
28
|
+
def call(env)
|
29
|
+
kind = env['kind']
|
30
|
+
if kind && @map.has_key?(kind)
|
31
|
+
return @map[kind].call env
|
32
|
+
elsif @not_found
|
33
|
+
return @not_found.call env
|
34
|
+
end
|
35
|
+
return [
|
36
|
+
404,
|
37
|
+
{
|
38
|
+
'Content-Type' => 'text/plain',
|
39
|
+
'X-Cascade' => 'pass'
|
40
|
+
},
|
41
|
+
['Not Found']
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'active_support/core_ext/hash'
|
2
|
+
require 'msgpack/rpc'
|
3
|
+
|
4
|
+
module Serf
|
5
|
+
|
6
|
+
##
|
7
|
+
# A MsgpackRpc handler that is just here to act as a protective
|
8
|
+
# facade to only expose the 'call' rpc method to MsgpackRpc clients.
|
9
|
+
#
|
10
|
+
class MsgpackHandler
|
11
|
+
def initialize(app, options={})
|
12
|
+
@app = app
|
13
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
@app.call env.stringify_keys
|
18
|
+
rescue => e
|
19
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
20
|
+
# We reraise this error so it's passed on through to the remote client.
|
21
|
+
raise e
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Defines a Msgpack RPC Server to run to receive messages.
|
27
|
+
#
|
28
|
+
class MsgpackReceiver
|
29
|
+
DEFAULT_SERVER_TRANSPORT_CLASS = MessagePack::RPC::TCPServerTransport
|
30
|
+
DEFAULT_ADDRESS_CLASS = MessagePack::RPC::Address
|
31
|
+
|
32
|
+
def initialize(app, options={})
|
33
|
+
@handler = options.fetch(:handler) { MsgpackHandler.new(app) }
|
34
|
+
|
35
|
+
@listener = options.fetch(:listener) {
|
36
|
+
host = options.fetch(:host) { '0.0.0.0' }
|
37
|
+
port = options.fetch(:port) { 18800 }
|
38
|
+
address = DEFAULT_ADDRESS_CLASS.new host, port
|
39
|
+
DEFAULT_SERVER_TRANSPORT_CLASS.new address
|
40
|
+
}
|
41
|
+
|
42
|
+
@rpc_class = options.fetch(:rpc_class) { MessagePack::RPC::Server }
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Runs, doesn't return.
|
47
|
+
def run
|
48
|
+
svr = @rpc_class.new
|
49
|
+
svr.listen @listener, @handler
|
50
|
+
svr.run
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'active_support/core_ext/hash'
|
2
|
+
require 'multi_json'
|
3
|
+
require "redis"
|
4
|
+
|
5
|
+
module Serf
|
6
|
+
|
7
|
+
##
|
8
|
+
# Defines a receiver that listens for messages from a subscribed
|
9
|
+
# Redis pubsub channel.
|
10
|
+
#
|
11
|
+
class RedisPubsubReceiver
|
12
|
+
|
13
|
+
def initialize(app, options={})
|
14
|
+
@app = app
|
15
|
+
|
16
|
+
@redis = options.fetch(:redis) { Redis.connect }
|
17
|
+
@channel = options.fetch(:channel) { 'serf_pubsub_channel' }
|
18
|
+
@logger = options.fetch(:logger) { ::Serf::NullObject.new }
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# Runs, doesn't return.
|
23
|
+
def run
|
24
|
+
@redis.subscribe(@channel) do |on|
|
25
|
+
on.message do |channel, message|
|
26
|
+
begin
|
27
|
+
decoded_message = MultiJson.decode message
|
28
|
+
raise 'Received non-hash JSON' unless decoded_message.kind_of? Hash
|
29
|
+
@app.call decoded_message.stringify_keys
|
30
|
+
rescue => e
|
31
|
+
@logger.error e
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
data/lib/serf/version.rb
ADDED
data/serf.gemspec
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "serf"
|
8
|
+
s.version = "0.1.0.alpha1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Benjamin Yu"]
|
12
|
+
s.date = "2011-11-03"
|
13
|
+
s.description = "Event-Driven SOA with CQRS"
|
14
|
+
s.email = "benjaminlyu@gmail.com"
|
15
|
+
s.executables = ["serfup"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"NOTICE.txt",
|
27
|
+
"README.md",
|
28
|
+
"Rakefile",
|
29
|
+
"bin/serfup",
|
30
|
+
"examples/config.su",
|
31
|
+
"lib/serf.rb",
|
32
|
+
"lib/serf/builder.rb",
|
33
|
+
"lib/serf/emitters/redis_emitter.rb",
|
34
|
+
"lib/serf/middleware/celluloid_runner.rb",
|
35
|
+
"lib/serf/middleware/em_runner.rb",
|
36
|
+
"lib/serf/middleware/kind_mapper.rb",
|
37
|
+
"lib/serf/null_object.rb",
|
38
|
+
"lib/serf/receivers/msgpack_receiver.rb",
|
39
|
+
"lib/serf/receivers/redis_pubsub_receiver.rb",
|
40
|
+
"lib/serf/version.rb",
|
41
|
+
"serf.gemspec",
|
42
|
+
"spec/serf_spec.rb",
|
43
|
+
"spec/spec_helper.rb"
|
44
|
+
]
|
45
|
+
s.homepage = "http://github.com/byu/serf"
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = "1.8.10"
|
49
|
+
s.summary = "Event-Driven SOA with CQRS"
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.1.1"])
|
56
|
+
s.add_runtime_dependency(%q<eventmachine>, ["~> 0.12.10"])
|
57
|
+
s.add_runtime_dependency(%q<i18n>, ["~> 0.6.0"])
|
58
|
+
s.add_runtime_dependency(%q<msgpack>, ["~> 0.4.6"])
|
59
|
+
s.add_runtime_dependency(%q<msgpack-rpc>, ["~> 0.4.5"])
|
60
|
+
s.add_runtime_dependency(%q<multi_json>, ["~> 1.0.3"])
|
61
|
+
s.add_runtime_dependency(%q<rack>, ["~> 1.3.5"])
|
62
|
+
s.add_runtime_dependency(%q<redis>, ["~> 2.2.2"])
|
63
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
64
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
65
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
66
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
67
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<log4r>, ["~> 1.1.9"])
|
69
|
+
s.add_development_dependency(%q<celluloid>, ["~> 0.5.0"])
|
70
|
+
else
|
71
|
+
s.add_dependency(%q<activesupport>, ["~> 3.1.1"])
|
72
|
+
s.add_dependency(%q<eventmachine>, ["~> 0.12.10"])
|
73
|
+
s.add_dependency(%q<i18n>, ["~> 0.6.0"])
|
74
|
+
s.add_dependency(%q<msgpack>, ["~> 0.4.6"])
|
75
|
+
s.add_dependency(%q<msgpack-rpc>, ["~> 0.4.5"])
|
76
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0.3"])
|
77
|
+
s.add_dependency(%q<rack>, ["~> 1.3.5"])
|
78
|
+
s.add_dependency(%q<redis>, ["~> 2.2.2"])
|
79
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
80
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
81
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
82
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
83
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
84
|
+
s.add_dependency(%q<log4r>, ["~> 1.1.9"])
|
85
|
+
s.add_dependency(%q<celluloid>, ["~> 0.5.0"])
|
86
|
+
end
|
87
|
+
else
|
88
|
+
s.add_dependency(%q<activesupport>, ["~> 3.1.1"])
|
89
|
+
s.add_dependency(%q<eventmachine>, ["~> 0.12.10"])
|
90
|
+
s.add_dependency(%q<i18n>, ["~> 0.6.0"])
|
91
|
+
s.add_dependency(%q<msgpack>, ["~> 0.4.6"])
|
92
|
+
s.add_dependency(%q<msgpack-rpc>, ["~> 0.4.5"])
|
93
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0.3"])
|
94
|
+
s.add_dependency(%q<rack>, ["~> 1.3.5"])
|
95
|
+
s.add_dependency(%q<redis>, ["~> 2.2.2"])
|
96
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
97
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
98
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
99
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
100
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
101
|
+
s.add_dependency(%q<log4r>, ["~> 1.1.9"])
|
102
|
+
s.add_dependency(%q<celluloid>, ["~> 0.5.0"])
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0.alpha1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,99 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &70284262969520 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70284262969520
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: eventmachine
|
27
|
+
requirement: &70284262967940 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.12.10
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70284262967940
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: i18n
|
38
|
+
requirement: &70284262966820 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.6.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70284262966820
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: msgpack
|
49
|
+
requirement: &70284262965600 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.6
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70284262965600
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: msgpack-rpc
|
60
|
+
requirement: &70284262964540 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.4.5
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70284262964540
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: multi_json
|
71
|
+
requirement: &70284262963360 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.3
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70284262963360
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rack
|
82
|
+
requirement: &70284262962220 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.3.5
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70284262962220
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: redis
|
93
|
+
requirement: &70284262961440 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 2.2.2
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70284262961440
|
14
102
|
- !ruby/object:Gem::Dependency
|
15
103
|
name: rspec
|
16
|
-
requirement: &
|
104
|
+
requirement: &70284262960340 !ruby/object:Gem::Requirement
|
17
105
|
none: false
|
18
106
|
requirements:
|
19
107
|
- - ~>
|
@@ -21,10 +109,10 @@ dependencies:
|
|
21
109
|
version: 2.3.0
|
22
110
|
type: :development
|
23
111
|
prerelease: false
|
24
|
-
version_requirements: *
|
112
|
+
version_requirements: *70284262960340
|
25
113
|
- !ruby/object:Gem::Dependency
|
26
114
|
name: yard
|
27
|
-
requirement: &
|
115
|
+
requirement: &70284262914860 !ruby/object:Gem::Requirement
|
28
116
|
none: false
|
29
117
|
requirements:
|
30
118
|
- - ~>
|
@@ -32,10 +120,10 @@ dependencies:
|
|
32
120
|
version: 0.6.0
|
33
121
|
type: :development
|
34
122
|
prerelease: false
|
35
|
-
version_requirements: *
|
123
|
+
version_requirements: *70284262914860
|
36
124
|
- !ruby/object:Gem::Dependency
|
37
125
|
name: bundler
|
38
|
-
requirement: &
|
126
|
+
requirement: &70284262913600 !ruby/object:Gem::Requirement
|
39
127
|
none: false
|
40
128
|
requirements:
|
41
129
|
- - ~>
|
@@ -43,10 +131,10 @@ dependencies:
|
|
43
131
|
version: 1.0.0
|
44
132
|
type: :development
|
45
133
|
prerelease: false
|
46
|
-
version_requirements: *
|
134
|
+
version_requirements: *70284262913600
|
47
135
|
- !ruby/object:Gem::Dependency
|
48
136
|
name: jeweler
|
49
|
-
requirement: &
|
137
|
+
requirement: &70284262912720 !ruby/object:Gem::Requirement
|
50
138
|
none: false
|
51
139
|
requirements:
|
52
140
|
- - ~>
|
@@ -54,10 +142,10 @@ dependencies:
|
|
54
142
|
version: 1.6.4
|
55
143
|
type: :development
|
56
144
|
prerelease: false
|
57
|
-
version_requirements: *
|
145
|
+
version_requirements: *70284262912720
|
58
146
|
- !ruby/object:Gem::Dependency
|
59
147
|
name: rcov
|
60
|
-
requirement: &
|
148
|
+
requirement: &70284262911900 !ruby/object:Gem::Requirement
|
61
149
|
none: false
|
62
150
|
requirements:
|
63
151
|
- - ! '>='
|
@@ -65,22 +153,59 @@ dependencies:
|
|
65
153
|
version: '0'
|
66
154
|
type: :development
|
67
155
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
-
|
156
|
+
version_requirements: *70284262911900
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: log4r
|
159
|
+
requirement: &70284262910880 !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ~>
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 1.1.9
|
165
|
+
type: :development
|
166
|
+
prerelease: false
|
167
|
+
version_requirements: *70284262910880
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: celluloid
|
170
|
+
requirement: &70284262909900 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ~>
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 0.5.0
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *70284262909900
|
179
|
+
description: Event-Driven SOA with CQRS
|
70
180
|
email: benjaminlyu@gmail.com
|
71
|
-
executables:
|
181
|
+
executables:
|
182
|
+
- serfup
|
72
183
|
extensions: []
|
73
184
|
extra_rdoc_files:
|
74
185
|
- LICENSE.txt
|
75
|
-
- README.
|
186
|
+
- README.md
|
76
187
|
files:
|
77
188
|
- .document
|
78
189
|
- .rspec
|
79
190
|
- Gemfile
|
191
|
+
- Gemfile.lock
|
80
192
|
- LICENSE.txt
|
81
|
-
-
|
193
|
+
- NOTICE.txt
|
194
|
+
- README.md
|
82
195
|
- Rakefile
|
196
|
+
- bin/serfup
|
197
|
+
- examples/config.su
|
83
198
|
- lib/serf.rb
|
199
|
+
- lib/serf/builder.rb
|
200
|
+
- lib/serf/emitters/redis_emitter.rb
|
201
|
+
- lib/serf/middleware/celluloid_runner.rb
|
202
|
+
- lib/serf/middleware/em_runner.rb
|
203
|
+
- lib/serf/middleware/kind_mapper.rb
|
204
|
+
- lib/serf/null_object.rb
|
205
|
+
- lib/serf/receivers/msgpack_receiver.rb
|
206
|
+
- lib/serf/receivers/redis_pubsub_receiver.rb
|
207
|
+
- lib/serf/version.rb
|
208
|
+
- serf.gemspec
|
84
209
|
- spec/serf_spec.rb
|
85
210
|
- spec/spec_helper.rb
|
86
211
|
homepage: http://github.com/byu/serf
|
@@ -98,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
223
|
version: '0'
|
99
224
|
segments:
|
100
225
|
- 0
|
101
|
-
hash:
|
226
|
+
hash: 1899332783665321639
|
102
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
228
|
none: false
|
104
229
|
requirements:
|
@@ -110,5 +235,5 @@ rubyforge_project:
|
|
110
235
|
rubygems_version: 1.8.10
|
111
236
|
signing_key:
|
112
237
|
specification_version: 3
|
113
|
-
summary:
|
238
|
+
summary: Event-Driven SOA with CQRS
|
114
239
|
test_files: []
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= serf
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to serf
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
-
* Fork the project
|
10
|
-
* Start a feature/bugfix branch
|
11
|
-
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2011 Benjamin Yu. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|