messaging 3.4.3 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30a2583692555ea89d81c50ea5cbf03f21763c3e030ceded07ecbf2f46335015
4
- data.tar.gz: 61164fd9cc9bae8acffe8094bcfcf3dfd4ca2d39fb03f279488d64f5e8a212e8
3
+ metadata.gz: 441c7c47e5f82c297229ac9651d306554adc0571adf8533d7a98ac07d25223e3
4
+ data.tar.gz: 892513550640905f8fe3db14921edc8ea18e4dc6b98c18d632e49bac1a9bdd94
5
5
  SHA512:
6
- metadata.gz: bd04d056d7dd80c5b7a79d0ff999c5feefb0e1f77e176f9b13c8931b1b439bb3d7ade1746ad951c7e43d43d96d439909c79b190c423fdaf11cd195870b896b71
7
- data.tar.gz: ffc5d6ba0b9801ca7ef4f55232815c0719c10e8c7e2d27fa8a6f94a1109d195143ee43c861372c92f33c7e7e9ef99f1674ab00ccb87a8b39d8b50e9b69916945
6
+ metadata.gz: 029f9c439069df9db00b4adc8f948eeda489498bf9bf5acde6d85f2236b78636d627c7c99e045875cbdfd586da0fc1e68618d5aa378e3c8b2768ec654068434b
7
+ data.tar.gz: 4c72b14e9646de2ad2a5898051cb1ee1b20ba3156aabc33d66cd67bede63cb42881308bd28614a199c1678b8c716053b0b68401badcd1a4870fb0811fb57b0c5
data/.gitignore CHANGED
@@ -6,8 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ _site/
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
12
-
13
- Gemfile.lock
data/Gemfile CHANGED
@@ -10,4 +10,7 @@ gem 'pry-rails'
10
10
  gem 'railties'
11
11
  gem 'sidekiq'
12
12
 
13
+ gem "github-pages", '203', group: :jekyll_plugins
14
+ gem "jekyll-include-cache", group: :jekyll_plugins
15
+
13
16
  gemspec
@@ -0,0 +1,421 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ messaging (3.5.1)
5
+ activerecord
6
+ activesupport
7
+ after_transaction
8
+ concurrent-ruby (>= 1.0.2)
9
+ concurrent-ruby-ext (>= 1.0.2)
10
+ dry-configurable
11
+ dry-container
12
+ dry-equalizer
13
+ dry-initializer
14
+ meter (>= 1.2.1)
15
+ method_object
16
+ ruby-kafka (>= 0.5.3)
17
+ virtus
18
+
19
+ GEM
20
+ remote: https://rubygems.org/
21
+ specs:
22
+ actionpack (5.2.4)
23
+ actionview (= 5.2.4)
24
+ activesupport (= 5.2.4)
25
+ rack (~> 2.0)
26
+ rack-test (>= 0.6.3)
27
+ rails-dom-testing (~> 2.0)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ actionview (5.2.4)
30
+ activesupport (= 5.2.4)
31
+ builder (~> 3.1)
32
+ erubi (~> 1.4)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
+ activemodel (5.2.4)
36
+ activesupport (= 5.2.4)
37
+ activerecord (5.2.4)
38
+ activemodel (= 5.2.4)
39
+ activesupport (= 5.2.4)
40
+ arel (>= 9.0)
41
+ activesupport (5.2.4)
42
+ concurrent-ruby (~> 1.0, >= 1.0.2)
43
+ i18n (>= 0.7, < 2)
44
+ minitest (~> 5.1)
45
+ tzinfo (~> 1.1)
46
+ addressable (2.7.0)
47
+ public_suffix (>= 2.0.2, < 5.0)
48
+ after_transaction (0.0.3)
49
+ activerecord (< 6.0)
50
+ arel (9.0.0)
51
+ axiom-types (0.1.1)
52
+ descendants_tracker (~> 0.0.4)
53
+ ice_nine (~> 0.11.0)
54
+ thread_safe (~> 0.3, >= 0.3.1)
55
+ bootsnap (1.4.5)
56
+ msgpack (~> 1.0)
57
+ builder (3.2.4)
58
+ coderay (1.1.2)
59
+ coercible (1.0.0)
60
+ descendants_tracker (~> 0.0.1)
61
+ coffee-script (2.4.1)
62
+ coffee-script-source
63
+ execjs
64
+ coffee-script-source (1.11.1)
65
+ colorator (1.1.0)
66
+ commonmarker (0.17.13)
67
+ ruby-enum (~> 0.5)
68
+ concurrent-ruby (1.1.5)
69
+ concurrent-ruby-ext (1.1.5)
70
+ concurrent-ruby (= 1.1.5)
71
+ connection_pool (2.2.2)
72
+ crass (1.0.5)
73
+ descendants_tracker (0.0.4)
74
+ thread_safe (~> 0.3, >= 0.3.1)
75
+ diff-lcs (1.3)
76
+ digest-crc (0.5.1)
77
+ dnsruby (1.61.3)
78
+ addressable (~> 2.5)
79
+ docile (1.3.2)
80
+ dry-configurable (0.8.3)
81
+ concurrent-ruby (~> 1.0)
82
+ dry-core (~> 0.4, >= 0.4.7)
83
+ dry-container (0.7.2)
84
+ concurrent-ruby (~> 1.0)
85
+ dry-configurable (~> 0.1, >= 0.1.3)
86
+ dry-core (0.4.9)
87
+ concurrent-ruby (~> 1.0)
88
+ dry-equalizer (0.2.2)
89
+ dry-initializer (3.0.3)
90
+ em-websocket (0.5.1)
91
+ eventmachine (>= 0.12.9)
92
+ http_parser.rb (~> 0.6.0)
93
+ equalizer (0.0.11)
94
+ erubi (1.9.0)
95
+ ethon (0.12.0)
96
+ ffi (>= 1.3.0)
97
+ eventmachine (1.2.7)
98
+ execjs (2.7.0)
99
+ faraday (0.17.1)
100
+ multipart-post (>= 1.2, < 3)
101
+ ffi (1.11.3)
102
+ forwardable-extended (2.6.0)
103
+ gemoji (3.0.1)
104
+ geocoder (1.2.13)
105
+ github-pages (203)
106
+ github-pages-health-check (= 1.16.1)
107
+ jekyll (= 3.8.5)
108
+ jekyll-avatar (= 0.7.0)
109
+ jekyll-coffeescript (= 1.1.1)
110
+ jekyll-commonmark-ghpages (= 0.1.6)
111
+ jekyll-default-layout (= 0.1.4)
112
+ jekyll-feed (= 0.13.0)
113
+ jekyll-gist (= 1.5.0)
114
+ jekyll-github-metadata (= 2.12.1)
115
+ jekyll-mentions (= 1.5.1)
116
+ jekyll-optional-front-matter (= 0.3.2)
117
+ jekyll-paginate (= 1.1.0)
118
+ jekyll-readme-index (= 0.3.0)
119
+ jekyll-redirect-from (= 0.15.0)
120
+ jekyll-relative-links (= 0.6.1)
121
+ jekyll-remote-theme (= 0.4.1)
122
+ jekyll-sass-converter (= 1.5.2)
123
+ jekyll-seo-tag (= 2.6.1)
124
+ jekyll-sitemap (= 1.4.0)
125
+ jekyll-swiss (= 1.0.0)
126
+ jekyll-theme-architect (= 0.1.1)
127
+ jekyll-theme-cayman (= 0.1.1)
128
+ jekyll-theme-dinky (= 0.1.1)
129
+ jekyll-theme-hacker (= 0.1.1)
130
+ jekyll-theme-leap-day (= 0.1.1)
131
+ jekyll-theme-merlot (= 0.1.1)
132
+ jekyll-theme-midnight (= 0.1.1)
133
+ jekyll-theme-minimal (= 0.1.1)
134
+ jekyll-theme-modernist (= 0.1.1)
135
+ jekyll-theme-primer (= 0.5.4)
136
+ jekyll-theme-slate (= 0.1.1)
137
+ jekyll-theme-tactile (= 0.1.1)
138
+ jekyll-theme-time-machine (= 0.1.1)
139
+ jekyll-titles-from-headings (= 0.5.3)
140
+ jemoji (= 0.11.1)
141
+ kramdown (= 1.17.0)
142
+ liquid (= 4.0.3)
143
+ mercenary (~> 0.3)
144
+ minima (= 2.5.1)
145
+ nokogiri (>= 1.10.4, < 2.0)
146
+ rouge (= 3.13.0)
147
+ terminal-table (~> 1.4)
148
+ github-pages-health-check (1.16.1)
149
+ addressable (~> 2.3)
150
+ dnsruby (~> 1.60)
151
+ octokit (~> 4.0)
152
+ public_suffix (~> 3.0)
153
+ typhoeus (~> 1.3)
154
+ hashie (4.1.0)
155
+ html-pipeline (2.12.2)
156
+ activesupport (>= 2)
157
+ nokogiri (>= 1.4)
158
+ http_parser.rb (0.6.0)
159
+ i18n (0.9.5)
160
+ concurrent-ruby (~> 1.0)
161
+ ice_nine (0.11.2)
162
+ jekyll (3.8.5)
163
+ addressable (~> 2.4)
164
+ colorator (~> 1.0)
165
+ em-websocket (~> 0.5)
166
+ i18n (~> 0.7)
167
+ jekyll-sass-converter (~> 1.0)
168
+ jekyll-watch (~> 2.0)
169
+ kramdown (~> 1.14)
170
+ liquid (~> 4.0)
171
+ mercenary (~> 0.3.3)
172
+ pathutil (~> 0.9)
173
+ rouge (>= 1.7, < 4)
174
+ safe_yaml (~> 1.0)
175
+ jekyll-avatar (0.7.0)
176
+ jekyll (>= 3.0, < 5.0)
177
+ jekyll-coffeescript (1.1.1)
178
+ coffee-script (~> 2.2)
179
+ coffee-script-source (~> 1.11.1)
180
+ jekyll-commonmark (1.3.1)
181
+ commonmarker (~> 0.14)
182
+ jekyll (>= 3.7, < 5.0)
183
+ jekyll-commonmark-ghpages (0.1.6)
184
+ commonmarker (~> 0.17.6)
185
+ jekyll-commonmark (~> 1.2)
186
+ rouge (>= 2.0, < 4.0)
187
+ jekyll-default-layout (0.1.4)
188
+ jekyll (~> 3.0)
189
+ jekyll-feed (0.13.0)
190
+ jekyll (>= 3.7, < 5.0)
191
+ jekyll-gist (1.5.0)
192
+ octokit (~> 4.2)
193
+ jekyll-github-metadata (2.12.1)
194
+ jekyll (~> 3.4)
195
+ octokit (~> 4.0, != 4.4.0)
196
+ jekyll-include-cache (0.2.0)
197
+ jekyll (>= 3.7, < 5.0)
198
+ jekyll-mentions (1.5.1)
199
+ html-pipeline (~> 2.3)
200
+ jekyll (>= 3.7, < 5.0)
201
+ jekyll-optional-front-matter (0.3.2)
202
+ jekyll (>= 3.0, < 5.0)
203
+ jekyll-paginate (1.1.0)
204
+ jekyll-readme-index (0.3.0)
205
+ jekyll (>= 3.0, < 5.0)
206
+ jekyll-redirect-from (0.15.0)
207
+ jekyll (>= 3.3, < 5.0)
208
+ jekyll-relative-links (0.6.1)
209
+ jekyll (>= 3.3, < 5.0)
210
+ jekyll-remote-theme (0.4.1)
211
+ addressable (~> 2.0)
212
+ jekyll (>= 3.5, < 5.0)
213
+ rubyzip (>= 1.3.0)
214
+ jekyll-sass-converter (1.5.2)
215
+ sass (~> 3.4)
216
+ jekyll-seo-tag (2.6.1)
217
+ jekyll (>= 3.3, < 5.0)
218
+ jekyll-sitemap (1.4.0)
219
+ jekyll (>= 3.7, < 5.0)
220
+ jekyll-swiss (1.0.0)
221
+ jekyll-theme-architect (0.1.1)
222
+ jekyll (~> 3.5)
223
+ jekyll-seo-tag (~> 2.0)
224
+ jekyll-theme-cayman (0.1.1)
225
+ jekyll (~> 3.5)
226
+ jekyll-seo-tag (~> 2.0)
227
+ jekyll-theme-dinky (0.1.1)
228
+ jekyll (~> 3.5)
229
+ jekyll-seo-tag (~> 2.0)
230
+ jekyll-theme-hacker (0.1.1)
231
+ jekyll (~> 3.5)
232
+ jekyll-seo-tag (~> 2.0)
233
+ jekyll-theme-leap-day (0.1.1)
234
+ jekyll (~> 3.5)
235
+ jekyll-seo-tag (~> 2.0)
236
+ jekyll-theme-merlot (0.1.1)
237
+ jekyll (~> 3.5)
238
+ jekyll-seo-tag (~> 2.0)
239
+ jekyll-theme-midnight (0.1.1)
240
+ jekyll (~> 3.5)
241
+ jekyll-seo-tag (~> 2.0)
242
+ jekyll-theme-minimal (0.1.1)
243
+ jekyll (~> 3.5)
244
+ jekyll-seo-tag (~> 2.0)
245
+ jekyll-theme-modernist (0.1.1)
246
+ jekyll (~> 3.5)
247
+ jekyll-seo-tag (~> 2.0)
248
+ jekyll-theme-primer (0.5.4)
249
+ jekyll (> 3.5, < 5.0)
250
+ jekyll-github-metadata (~> 2.9)
251
+ jekyll-seo-tag (~> 2.0)
252
+ jekyll-theme-slate (0.1.1)
253
+ jekyll (~> 3.5)
254
+ jekyll-seo-tag (~> 2.0)
255
+ jekyll-theme-tactile (0.1.1)
256
+ jekyll (~> 3.5)
257
+ jekyll-seo-tag (~> 2.0)
258
+ jekyll-theme-time-machine (0.1.1)
259
+ jekyll (~> 3.5)
260
+ jekyll-seo-tag (~> 2.0)
261
+ jekyll-titles-from-headings (0.5.3)
262
+ jekyll (>= 3.3, < 5.0)
263
+ jekyll-watch (2.2.1)
264
+ listen (~> 3.0)
265
+ jemoji (0.11.1)
266
+ gemoji (~> 3.0)
267
+ html-pipeline (~> 2.2)
268
+ jekyll (>= 3.0, < 5.0)
269
+ json (2.3.0)
270
+ kramdown (1.17.0)
271
+ liquid (4.0.3)
272
+ listen (3.2.1)
273
+ rb-fsevent (~> 0.10, >= 0.10.3)
274
+ rb-inotify (~> 0.9, >= 0.9.10)
275
+ locality (1.1.0)
276
+ activesupport
277
+ geocoder (= 1.2.13)
278
+ hashie
279
+ i18n
280
+ maxminddb (= 0.1.8)
281
+ operation
282
+ trouble
283
+ loofah (2.4.0)
284
+ crass (~> 1.0.2)
285
+ nokogiri (>= 1.5.9)
286
+ maxminddb (0.1.8)
287
+ mercenary (0.3.6)
288
+ meter (1.2.7)
289
+ locality (~> 1.1.0)
290
+ useragent (~> 0.16.3)
291
+ method_object (1.0.0)
292
+ dry-initializer
293
+ method_source (0.9.2)
294
+ mini_portile2 (2.4.0)
295
+ minima (2.5.1)
296
+ jekyll (>= 3.5, < 5.0)
297
+ jekyll-feed (~> 0.9)
298
+ jekyll-seo-tag (~> 2.1)
299
+ minitest (5.13.0)
300
+ msgpack (1.3.1)
301
+ multipart-post (2.1.1)
302
+ nokogiri (1.10.7)
303
+ mini_portile2 (~> 2.4.0)
304
+ octokit (4.14.0)
305
+ sawyer (~> 0.8.0, >= 0.5.3)
306
+ operation (1.4.1)
307
+ pathutil (0.16.2)
308
+ forwardable-extended (~> 2.6)
309
+ pg (1.1.4)
310
+ pry (0.12.2)
311
+ coderay (~> 1.1.0)
312
+ method_source (~> 0.9.0)
313
+ pry-rails (0.3.9)
314
+ pry (>= 0.10.4)
315
+ public_suffix (3.1.1)
316
+ rack (2.0.7)
317
+ rack-protection (2.0.7)
318
+ rack
319
+ rack-test (1.1.0)
320
+ rack (>= 1.0, < 3)
321
+ rails-dom-testing (2.0.3)
322
+ activesupport (>= 4.2.0)
323
+ nokogiri (>= 1.6)
324
+ rails-html-sanitizer (1.3.0)
325
+ loofah (~> 2.3)
326
+ railties (5.2.4)
327
+ actionpack (= 5.2.4)
328
+ activesupport (= 5.2.4)
329
+ method_source
330
+ rake (>= 0.8.7)
331
+ thor (>= 0.19.0, < 2.0)
332
+ rake (10.5.0)
333
+ rb-fsevent (0.10.3)
334
+ rb-inotify (0.10.0)
335
+ ffi (~> 1.0)
336
+ redis (4.1.3)
337
+ rouge (3.13.0)
338
+ rspec (3.9.0)
339
+ rspec-core (~> 3.9.0)
340
+ rspec-expectations (~> 3.9.0)
341
+ rspec-mocks (~> 3.9.0)
342
+ rspec-core (3.9.0)
343
+ rspec-support (~> 3.9.0)
344
+ rspec-expectations (3.9.0)
345
+ diff-lcs (>= 1.2.0, < 2.0)
346
+ rspec-support (~> 3.9.0)
347
+ rspec-mocks (3.9.0)
348
+ diff-lcs (>= 1.2.0, < 2.0)
349
+ rspec-support (~> 3.9.0)
350
+ rspec-rails (3.9.0)
351
+ actionpack (>= 3.0)
352
+ activesupport (>= 3.0)
353
+ railties (>= 3.0)
354
+ rspec-core (~> 3.9.0)
355
+ rspec-expectations (~> 3.9.0)
356
+ rspec-mocks (~> 3.9.0)
357
+ rspec-support (~> 3.9.0)
358
+ rspec-support (3.9.0)
359
+ ruby-enum (0.7.2)
360
+ i18n
361
+ ruby-kafka (1.0.0)
362
+ digest-crc
363
+ rubyzip (1.3.0)
364
+ safe_yaml (1.0.5)
365
+ sass (3.7.4)
366
+ sass-listen (~> 4.0.0)
367
+ sass-listen (4.0.0)
368
+ rb-fsevent (~> 0.9, >= 0.9.4)
369
+ rb-inotify (~> 0.9, >= 0.9.7)
370
+ sawyer (0.8.2)
371
+ addressable (>= 2.3.5)
372
+ faraday (> 0.8, < 2.0)
373
+ sidekiq (5.2.7)
374
+ connection_pool (~> 2.2, >= 2.2.2)
375
+ rack (>= 1.5.0)
376
+ rack-protection (>= 1.5.0)
377
+ redis (>= 3.3.5, < 5)
378
+ simplecov (0.17.1)
379
+ docile (~> 1.1)
380
+ json (>= 1.8, < 3)
381
+ simplecov-html (~> 0.10.0)
382
+ simplecov-html (0.10.2)
383
+ terminal-table (1.8.0)
384
+ unicode-display_width (~> 1.1, >= 1.1.1)
385
+ thor (0.20.3)
386
+ thread_safe (0.3.6)
387
+ trouble (0.0.13)
388
+ typhoeus (1.3.1)
389
+ ethon (>= 0.9.0)
390
+ tzinfo (1.2.5)
391
+ thread_safe (~> 0.1)
392
+ unicode-display_width (1.6.0)
393
+ useragent (0.16.10)
394
+ virtus (1.0.5)
395
+ axiom-types (~> 0.1)
396
+ coercible (~> 1.0)
397
+ descendants_tracker (~> 0.0, >= 0.0.3)
398
+ equalizer (~> 0.0, >= 0.0.9)
399
+
400
+ PLATFORMS
401
+ ruby
402
+
403
+ DEPENDENCIES
404
+ bootsnap
405
+ bundler (~> 1.14)
406
+ github-pages (= 203)
407
+ jekyll-include-cache
408
+ listen
409
+ messaging!
410
+ pg
411
+ pry
412
+ pry-rails
413
+ railties
414
+ rake (~> 10.0)
415
+ rspec (~> 3.0)
416
+ rspec-rails
417
+ sidekiq
418
+ simplecov
419
+
420
+ BUNDLED WITH
421
+ 1.17.3
data/README.md CHANGED
@@ -1,53 +1,3 @@
1
- # Messaging
1
+ A library for decoupling applications by using messaging to communicate between components.
2
2
 
3
- Messaging is a library used to send and receive messages via Kafka.
4
-
5
-
6
- 1. [The three main concepts](#the-three-main-concepts)
7
- 1. [Messages](#messages)
8
- 2. [Topics](#topics)
9
- 3. [Handlers](#handlers)
10
- 2. [Usage](#usage)
11
- 1. [Creating messages](#creating-messages)
12
- 2. [Publishing messages](#publishing-messages)
13
- 3. [Receiving messages](#receiving-messages)
14
-
15
- ## The three main concepts
16
-
17
- The usage of this gem is based on three main concepts: messages, topics and handlers.
18
-
19
- ### Messages
20
-
21
- A message represents the actual messages we send and receive, example:
22
-
23
- ```ruby
24
- Module Events
25
- class LotViewed
26
- include ::Messaging::Message
27
-
28
- attribute :lot_id, Integer
29
- attribute :item_id, Integer
30
- attribute :customer_id, Integer
31
-
32
- end
33
- end
34
- ```
35
-
36
- Messages are published to Kafka topics. By default the topic has the same name as the message class (but underscored and / are replaced with - as Kafka doesn't allow '/' in topic names).
37
-
38
- In our example above, Events::LotViewed would be published to a topic named events-lot_viewed.
39
-
40
- ### Topics
41
-
42
- ### Handlers
43
-
44
- ## Usage
45
-
46
- ### Creating messages
47
- ### Publishing messages
48
- ### Receiving messages
49
-
50
- ## Making a new version
51
-
52
- Increase the version in version.rb
53
- run be rake release
3
+ More documentation and the code will be released in the near future...
@@ -1 +1,78 @@
1
- theme: jekyll-theme-minimal
1
+ # Welcome to Jekyll!
2
+ #
3
+ # This config file is meant for settings that affect your whole blog, values
4
+ # which you are expected to set up once and rarely edit after that. If you find
5
+ # yourself editing this file very often, consider using Jekyll's data files
6
+ # feature for the data you need to update frequently.
7
+ #
8
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
9
+ # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
+
11
+ # Site settings
12
+ # These are used to personalize your new site. If you look in the HTML files,
13
+ # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14
+ # You can create any custom variable you would like, and they will be accessible
15
+ # in the templates via {{ site.myvariable }}.
16
+ name: Bukowskis
17
+ title: Messaging
18
+ email:
19
+ description: >- # this means to ignore newlines until "baseurl:"
20
+ github_username: bukowskis
21
+ minimal_mistakes_skin: default
22
+ search: false
23
+
24
+ # Build settings
25
+ markdown: kramdown
26
+ remote_theme: mmistakes/minimal-mistakes
27
+ # Outputting
28
+ permalink: /:categories/:title/
29
+ timezone: CET # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
30
+
31
+ include:
32
+ - docs
33
+
34
+ # Exclude from processing.
35
+ # The following items will not be processed, by default. Create a custom list
36
+ # to override the default setting.
37
+ # exclude:
38
+ # - Gemfile
39
+ # - Gemfile.lock
40
+ # - node_modules
41
+ # - vendor/bundle/
42
+ # - vendor/cache/
43
+ # - vendor/gems/
44
+ # - vendor/ruby/
45
+
46
+ # Plugins (previously gems:)
47
+ plugins:
48
+ - jekyll-sitemap
49
+ - jekyll-gist
50
+ - jemoji
51
+ - jekyll-include-cache
52
+
53
+ author:
54
+ name : "Bukowskis"
55
+ avatar : "https://d5u8cl9t8qko.cloudfront.net/assets/bukowskis-e2de8e05a8661722556f9bd8f265777a45a0fef027b3ef6a77da5633df93447c.svg"
56
+ bio : ""
57
+ links:
58
+ - label: "Website"
59
+ icon: "fas fa-fw fa-link"
60
+ url: "https://www.bukowskis.com"
61
+ - label: "GitHub"
62
+ icon: "fab fa-fw fa-github"
63
+ url: "https://github.com/bukowskis"
64
+
65
+ footer:
66
+ links:
67
+ - label: "GitHub"
68
+ icon: "fab fa-fw fa-github"
69
+ url: "https://github.com/bukowskis/messaging"
70
+
71
+
72
+ defaults:
73
+ - scope:
74
+ path: ""
75
+ values:
76
+ layout: single
77
+ sidebar:
78
+ nav: "docs"
@@ -0,0 +1,17 @@
1
+ docs:
2
+ - title: Getting Started
3
+ children:
4
+ - title: "Installlation"
5
+ url: /docs/installation/
6
+ - title: "Adapters"
7
+ url: /docs/adapters/
8
+ - title: Messaging
9
+ children:
10
+ - title: "Messages"
11
+ url: /docs/messages/
12
+ - title: "Routing and handlers"
13
+ url: /docs/routing_and_handlers/
14
+ - title: "Publishing messages"
15
+ url: /docs/publishing/
16
+ - title: "Consuming messages"
17
+ url: /docs/consuming/
@@ -0,0 +1,95 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {% if page.header.overlay_color or page.header.overlay_image or page.header.image %}
6
+ {% include page__hero.html %}
7
+ {% elsif page.header.video.id and page.header.video.provider %}
8
+ {% include page__hero_video.html %}
9
+ {% endif %}
10
+
11
+ {% if page.url != "/" and site.breadcrumbs %}
12
+ {% unless paginator %}
13
+ {% include breadcrumbs.html %}
14
+ {% endunless %}
15
+ {% endif %}
16
+
17
+ <div id="main" role="main">
18
+ {% include sidebar.html %}
19
+
20
+ <article class="page" itemscope itemtype="https://schema.org/CreativeWork">
21
+ {% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
22
+ {% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
23
+ {% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date: "%B %d, %Y" }}">{% endif %}
24
+ {% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date: "%B %d, %Y" }}">{% endif %}
25
+
26
+ <div class="page__inner-wrap">
27
+ {% unless page.header.overlay_color or page.header.overlay_image %}
28
+ <header>
29
+ {% if page.title %}<h1 id="page-title" class="page__title" itemprop="headline">{{ page.title | markdownify | remove: "<p>" | remove: "</p>" }}</h1>{% endif %}
30
+ {% if page.read_time %}
31
+ <p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
32
+ {% endif %}
33
+ </header>
34
+ {% endunless %}
35
+
36
+ <section class="page__content" itemprop="text" style="font-size: 0.9em">
37
+ {% if page.toc %}
38
+ <aside class="sidebar__right {% if page.toc_sticky %}sticky{% endif %}">
39
+ <nav class="toc">
40
+ <header><h4 class="nav__title"><i class="fas fa-{{ page.toc_icon | default: 'file-alt' }}"></i> {{ page.toc_label | default: site.data.ui-text[site.locale].toc_label | default: "On this page" }}</h4></header>
41
+ {% include toc.html sanitize=true html=content h_min=1 h_max=6 class="toc__menu" %}
42
+ </nav>
43
+ </aside>
44
+ {% endif %}
45
+ {{ content }}
46
+ {% if page.link %}<div><a href="{{ page.link }}" class="btn btn--primary">{{ site.data.ui-text[site.locale].ext_link_label | default: "Direct Link" }}</a></div>{% endif %}
47
+ </section>
48
+
49
+ <footer class="page__meta">
50
+ {% if site.data.ui-text[site.locale].meta_label %}
51
+ <h4 class="page__meta-title">{{ site.data.ui-text[site.locale].meta_label }}</h4>
52
+ {% endif %}
53
+ {% include page__taxonomy.html %}
54
+ {% if page.last_modified_at %}
55
+ <p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong> <time datetime="{{ page.last_modified_at | date: "%Y-%m-%d" }}">{{ page.last_modified_at | date: "%B %d, %Y" }}</time></p>
56
+ {% elsif page.date %}
57
+ <p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong> <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time></p>
58
+ {% endif %}
59
+ </footer>
60
+
61
+ {% if page.share %}{% include social-share.html %}{% endif %}
62
+
63
+ {% include post_pagination.html %}
64
+ </div>
65
+
66
+ {% if jekyll.environment == 'production' and site.comments.provider and page.comments %}
67
+ {% include comments.html %}
68
+ {% endif %}
69
+ </article>
70
+
71
+ {% comment %}<!-- only show related on a post page when `related: true` -->{% endcomment %}
72
+ {% if page.id and page.related and site.related_posts.size > 0 %}
73
+ <div class="page__related">
74
+ <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
75
+ <div class="grid__wrapper">
76
+ {% for post in site.related_posts limit:4 %}
77
+ {% include archive-single.html type="grid" %}
78
+ {% endfor %}
79
+ </div>
80
+ </div>
81
+ {% comment %}<!-- otherwise show recent posts if no related when `related: true` -->{% endcomment %}
82
+ {% elsif page.id and page.related %}
83
+ <div class="page__related">
84
+ <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
85
+ <div class="grid__wrapper">
86
+ {% for post in site.posts limit:4 %}
87
+ {% if post.id == page.id %}
88
+ {% continue %}
89
+ {% endif %}
90
+ {% include archive-single.html type="grid" %}
91
+ {% endfor %}
92
+ </div>
93
+ </div>
94
+ {% endif %}
95
+ </div>
@@ -0,0 +1,4 @@
1
+ ---
2
+ permalink: /docs/adapters/
3
+ title: "Adapters"
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ permalink: /docs/consuming/
3
+ title: "Consuming"
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ permalink: /docs/installation/
3
+ title: "Installation"
4
+ ---
@@ -0,0 +1,13 @@
1
+ ---
2
+ permalink: /docs/messages/
3
+ title: "Messages"
4
+ ---
5
+
6
+ Messages are the core building block of messaging.
7
+ Define a message by including the message module like this:
8
+
9
+ ```ruby
10
+ class MyMessage
11
+ include Messaging::Message
12
+ end
13
+ ```
@@ -0,0 +1,4 @@
1
+ ---
2
+ permalink: /docs/publishing/
3
+ title: "Publishing"
4
+ ---
@@ -0,0 +1,64 @@
1
+ ---
2
+ permalink: /docs/routing_and_handlers/
3
+ title: "Routing and handlers"
4
+ toc: true
5
+ ---
6
+ ## Handlers
7
+
8
+ A handler is a piece of code that does something with a message.
9
+ There is no module or superclass that you need to use to implement a handler.
10
+ All that is needed is something that responds to .call with one argument, the message.
11
+
12
+ The following class can serve as a typical handler:
13
+
14
+ ```ruby
15
+ class NotifyCompetingBidders
16
+ def self.call(bid_placed)
17
+ other_bidders.each { |bidder| SendOutbidNotice.call(recipient: bidder) }
18
+ end
19
+ end
20
+ ```
21
+
22
+ But a handler can also be a plain block in a route:
23
+ ```ruby
24
+ class HandleBiddingEvents
25
+ include Messaging::Routing
26
+
27
+ def self.call(message)
28
+ new.handle(message)
29
+ end
30
+
31
+ # A block used as a handler
32
+ on BidPlaced do |bid_placed|
33
+ log_bid_event bid_placed
34
+ end
35
+ end
36
+ ```
37
+
38
+ ## Routing
39
+
40
+ There are multiple ways to route messages to handlers.
41
+
42
+
43
+ ### Synchronous handlers
44
+ Use the call: keyword in a route to make the handler synchronous.
45
+ ```ruby
46
+ Messaging.routes.draw do
47
+ on Events::BidPlaced, call: NotifyCompetingBidders
48
+ end
49
+ ```
50
+ **Be aware!** The handler would trigger in the same thread as the code that publishes the event.
51
+ This may or may not be a problem. But think twice before using synchronous handlers.
52
+ {: .notice}
53
+
54
+ ### Enqueued handlers
55
+ Use the enqueue: keyword to make a handler be called by a background worker like Sidekiq.
56
+ ```ruby
57
+ Messaging.routes.draw do
58
+ on Events::BidPlaced, enqueue: NotifyCompetingBidders
59
+ end
60
+ ```
61
+ **Be aware!** Sidekiq / Resque / ActiveJob does not guarantee that the jobs will be
62
+ processed in any specific order. If the order in which handlers gets called is important
63
+ you should probably use a Consumer instead
64
+ {: .notice}
@@ -14,7 +14,6 @@ require 'messaging/message'
14
14
  require 'messaging/message/from_json'
15
15
  require 'messaging/routing'
16
16
  require 'messaging/routes'
17
- require 'messaging/base_handler'
18
17
  require 'messaging/adapters'
19
18
  require 'messaging/middleware'
20
19
  require 'messaging/publish'
@@ -53,6 +52,10 @@ module Messaging
53
52
  @routes ||= Routes.new
54
53
  end
55
54
 
55
+ def self.inline!(&block)
56
+ routes.inline!(&block)
57
+ end
58
+
56
59
  def self.category(name)
57
60
  message_store.category(name)
58
61
  end
@@ -62,6 +65,10 @@ module Messaging
62
65
  message_store.stream(name)
63
66
  end
64
67
 
68
+ def self.messages_in_streams(*streams)
69
+ message_store.messages_in_streams(*streams)
70
+ end
71
+
65
72
  def self.defined_messages
66
73
  ObjectSpace.each_object(Class).select { |c| c.included_modules.include? Messaging::Message }
67
74
  end
@@ -62,6 +62,15 @@ module Messaging
62
62
  SerializedMessage
63
63
  end
64
64
 
65
+ # Access to all messages in the given streams
66
+ #
67
+ # @param streams [Array<String, Stream>] List of one or more streams to get messages from
68
+ # @return [ActiveRecord::Relation]
69
+ # @see Messaging.messages_in_streams
70
+ def messages_in_streams(*streams)
71
+ SerializedMessage.where(stream: streams.flatten.map(&:to_s)).order(:id)
72
+ end
73
+
65
74
  # Writes the message to Postgres
66
75
  # Skips messages that hasn't defined a stream name
67
76
  # We do this to begin with so PG is opt-in per message
@@ -27,6 +27,10 @@ module Messaging
27
27
  messages.maximum(:stream_position) || -1
28
28
  end
29
29
 
30
+ def to_s
31
+ name
32
+ end
33
+
30
34
  def inspect
31
35
  info = "current_position: #{current_position}"
32
36
  "#<Stream:#{name}> #{info}>"
@@ -49,6 +49,14 @@ module Messaging
49
49
  categories[name]
50
50
  end
51
51
 
52
+ # Access to all messages in the given streams
53
+ #
54
+ # @param streams [Array<String>] List of one or more streams to get messages from
55
+ # @return [Array<Messaging::Message>]
56
+ def messages_in_streams(*streams)
57
+ messages.select { |m| streams.flatten.map(&:to_s).include? m.stream_name }
58
+ end
59
+
52
60
  def clear!
53
61
  @streams = Hash.new { |h, k| h[k] = Stream.new(k) }
54
62
  categories.clear!
@@ -12,6 +12,10 @@ module Messaging
12
12
  @messages ||= []
13
13
  end
14
14
 
15
+ def to_s
16
+ name
17
+ end
18
+
15
19
  def current_position
16
20
  messages.length - 1
17
21
  end
@@ -22,6 +22,19 @@ module Messaging
22
22
  end
23
23
  end
24
24
 
25
+ def inline!(&block)
26
+ current_routes = @routes.dup
27
+ consumer_definitions.each do |_, definition|
28
+ definition.fetch(:block)&.call(self)
29
+ end
30
+
31
+ block.call
32
+
33
+ ensure
34
+ clear_routes!
35
+ @routes = current_routes
36
+ end
37
+
25
38
  # Keeps the consumers, but reload their subscriptions so code reloading works.
26
39
  # The consumer has a reference to the class name of each of its handlers,
27
40
  # if the handler is reloaded the reference would point to an old instance.
@@ -1,3 +1,3 @@
1
1
  module Messaging
2
- VERSION = '3.4.3'.freeze
2
+ VERSION = '3.5.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bukowskis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -275,11 +275,20 @@ files:
275
275
  - ".rspec"
276
276
  - ".ruby-version"
277
277
  - Gemfile
278
+ - Gemfile.lock
278
279
  - README.md
279
280
  - Rakefile
280
281
  - _config.yml
282
+ - _data/navigation.yml
283
+ - _layouts/single.html
281
284
  - bin/console
282
285
  - bin/setup
286
+ - docs/adapters.md
287
+ - docs/consuming.md
288
+ - docs/installation.md
289
+ - docs/messages.md
290
+ - docs/publishing.md
291
+ - docs/routing_and_handlers.md
283
292
  - exe/messaging
284
293
  - lib/messaging.rb
285
294
  - lib/messaging/adapters.rb
@@ -300,7 +309,6 @@ files:
300
309
  - lib/messaging/adapters/test/consumer.rb
301
310
  - lib/messaging/adapters/test/store.rb
302
311
  - lib/messaging/adapters/test/stream.rb
303
- - lib/messaging/base_handler.rb
304
312
  - lib/messaging/cli.rb
305
313
  - lib/messaging/config.rb
306
314
  - lib/messaging/consumer_supervisor.rb
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Messaging
4
- # @private
5
- # @deprecated
6
- class BaseHandler
7
- class << self
8
- def only_messages(messages = nil)
9
- @only_messages = Array(messages) if messages
10
- @only_messages || []
11
- end
12
- alias only_message only_messages
13
-
14
- def group_id(group_id = nil)
15
- @group_id = group_id if group_id
16
- @group_id || default_group_id
17
- end
18
-
19
- def default_group_id
20
- Config.app_name + '-' + name.underscore
21
- end
22
-
23
- def call(message)
24
- return unless allowed_message?(message.class)
25
-
26
- new.on_message(message, nil)
27
- end
28
-
29
- def listen_on(topic:)
30
- topics = Array(topic).map(&:to_s)
31
- Messaging.routes.consumer(name, group_id: group_id) do |c|
32
- topics.each { |t| c.on(->(m) { m.topic == t }, call: self) }
33
- end
34
- end
35
-
36
- def allowed_message?(message_class)
37
- return true if only_messages.empty?
38
-
39
- only_messages.include? message_class
40
- end
41
- end
42
-
43
- def on_message(message, _metadata); end
44
- end
45
- end