outboxer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +50 -22
- data/doc/Outboxer/Models/Exception.html +124 -0
- data/doc/Outboxer/Models/Message.html +144 -0
- data/doc/Outboxer/Models/Outboxable/ClassMethods.html +105 -0
- data/doc/Outboxer/Models/Outboxable.html +265 -0
- data/doc/Outboxer/Models.html +119 -0
- data/doc/Outboxer/Publisher/Args.html +310 -0
- data/doc/Outboxer/Publisher.html +384 -0
- data/doc/Outboxer/Railtie.html +124 -0
- data/doc/Outboxer.html +150 -0
- data/doc/_index.html +211 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +180 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +180 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +99 -0
- data/doc/top-level-namespace.html +110 -0
- data/generators/outboxer/templates/bin/publisher.rb +8 -1
- data/lib/outboxer/models/message.rb +2 -1
- data/lib/outboxer/publisher.rb +19 -0
- data/lib/outboxer/version.rb +1 -1
- data/lib/outboxer.rb +2 -0
- data/outboxer.gemspec +1 -1
- metadata +25 -15
@@ -0,0 +1,110 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Top Level Namespace</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<h2>Defined Under Namespace</h2>
|
82
|
+
<p class="children">
|
83
|
+
|
84
|
+
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Outboxer.html" title="Outboxer (module)">Outboxer</a></span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="footer">
|
103
|
+
Generated on Sat Aug 5 04:37:46 2023 by
|
104
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
+
0.9.34 (ruby-2.7.8).
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</body>
|
110
|
+
</html>
|
@@ -3,5 +3,12 @@
|
|
3
3
|
require_relative "../config/environment"
|
4
4
|
|
5
5
|
Outboxer::Publisher.publish do |args|
|
6
|
-
|
6
|
+
logger = args.logger
|
7
|
+
message = args.message
|
8
|
+
|
9
|
+
logger.info("[#{message.id}] publishing")
|
10
|
+
|
11
|
+
HardJob.perform_async({ "message_id" => message.id })
|
12
|
+
|
13
|
+
logger.info("[#{message.id}] published")
|
7
14
|
end
|
data/lib/outboxer/publisher.rb
CHANGED
@@ -9,6 +9,17 @@ module Outboxer
|
|
9
9
|
|
10
10
|
Args = Struct.new(:message, :logger)
|
11
11
|
|
12
|
+
# This method initiates the publishing process. It dequeues the messages one by one
|
13
|
+
# and yields to a block that should contain the publishing logic.
|
14
|
+
#
|
15
|
+
# @param [Integer] poll
|
16
|
+
# Sleep time in seconds between polling the queue when it's empty.
|
17
|
+
#
|
18
|
+
# @param [Proc] backoff
|
19
|
+
# A Proc that takes the current backoff time and returns the new backoff time.
|
20
|
+
#
|
21
|
+
# @yieldparam [Args] args
|
22
|
+
# An Args object containing the message to publish and a logger.
|
12
23
|
def publish(poll: 1, backoff: ->(current_backoff) { [current_backoff * 2, 5 * 60].min })
|
13
24
|
@publishing = true
|
14
25
|
|
@@ -100,6 +111,12 @@ module Outboxer
|
|
100
111
|
end
|
101
112
|
end
|
102
113
|
|
114
|
+
# Stops the publishing process.
|
115
|
+
#
|
116
|
+
# @note This method will stop the current message publishing process
|
117
|
+
# It is a safe way to interrupt the publishing process at any point.
|
118
|
+
#
|
119
|
+
# @return [void]
|
103
120
|
def stop
|
104
121
|
@publishing = false
|
105
122
|
end
|
@@ -109,5 +126,7 @@ module Outboxer
|
|
109
126
|
|
110
127
|
stop
|
111
128
|
end
|
129
|
+
|
130
|
+
private_class_method :retry_on_error, :dequeue, :published, :failed
|
112
131
|
end
|
113
132
|
end
|
data/lib/outboxer/version.rb
CHANGED
data/lib/outboxer.rb
CHANGED
data/outboxer.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
16
|
spec.metadata["source_code_uri"] = "https://github.com/fast-programmer/outboxer"
|
17
17
|
# spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
|
18
|
+
spec.metadata['yard.run'] = 'yard'
|
18
19
|
spec.metadata["rubygems_mfa_required"] = "true"
|
19
20
|
|
20
21
|
spec.files = Dir.chdir(__dir__) do
|
@@ -28,6 +29,5 @@ Gem::Specification.new do |spec|
|
|
28
29
|
spec.require_paths = ["lib"]
|
29
30
|
|
30
31
|
spec.add_dependency "activerecord", "~> 7.0"
|
31
|
-
spec.add_dependency "pg", "~> 1.5"
|
32
32
|
end
|
33
33
|
# rubocop:enable Layout/LineLength
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outboxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Mikulasev
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '7.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pg
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.5'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.5'
|
41
27
|
description:
|
42
28
|
email:
|
43
29
|
- adam@fastprogrammer.co
|
@@ -52,6 +38,29 @@ files:
|
|
52
38
|
- LICENSE.txt
|
53
39
|
- README.md
|
54
40
|
- Rakefile
|
41
|
+
- doc/Outboxer.html
|
42
|
+
- doc/Outboxer/Models.html
|
43
|
+
- doc/Outboxer/Models/Exception.html
|
44
|
+
- doc/Outboxer/Models/Message.html
|
45
|
+
- doc/Outboxer/Models/Outboxable.html
|
46
|
+
- doc/Outboxer/Models/Outboxable/ClassMethods.html
|
47
|
+
- doc/Outboxer/Publisher.html
|
48
|
+
- doc/Outboxer/Publisher/Args.html
|
49
|
+
- doc/Outboxer/Railtie.html
|
50
|
+
- doc/_index.html
|
51
|
+
- doc/class_list.html
|
52
|
+
- doc/css/common.css
|
53
|
+
- doc/css/full_list.css
|
54
|
+
- doc/css/style.css
|
55
|
+
- doc/file.README.html
|
56
|
+
- doc/file_list.html
|
57
|
+
- doc/frames.html
|
58
|
+
- doc/index.html
|
59
|
+
- doc/js/app.js
|
60
|
+
- doc/js/full_list.js
|
61
|
+
- doc/js/jquery.js
|
62
|
+
- doc/method_list.html
|
63
|
+
- doc/top-level-namespace.html
|
55
64
|
- generators/outboxer/install_generator.rb
|
56
65
|
- generators/outboxer/templates/bin/publisher.rb
|
57
66
|
- generators/outboxer/templates/migrations/create_outboxer_exceptions.rb
|
@@ -71,6 +80,7 @@ licenses:
|
|
71
80
|
metadata:
|
72
81
|
homepage_uri: https://github.com/fast-programmer/outboxer
|
73
82
|
source_code_uri: https://github.com/fast-programmer/outboxer
|
83
|
+
yard.run: yard
|
74
84
|
rubygems_mfa_required: 'true'
|
75
85
|
post_install_message:
|
76
86
|
rdoc_options: []
|