railway-ipc 0.1.7 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -3
- data/CHANGELOG.md +67 -0
- data/Gemfile +2 -2
- data/README.md +1 -1
- data/Rakefile +10 -4
- data/bin/console +3 -3
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/lib/railway_ipc.rb +9 -11
- data/lib/railway_ipc/Rakefile +2 -0
- data/lib/railway_ipc/consumer/consumer.rb +33 -73
- data/lib/railway_ipc/consumer/process_incoming_message.rb +111 -0
- data/lib/railway_ipc/errors.rb +9 -1
- data/lib/railway_ipc/handler.rb +17 -3
- data/lib/railway_ipc/handler_store.rb +5 -2
- data/lib/railway_ipc/incoming_message.rb +51 -0
- data/lib/railway_ipc/logger.rb +44 -26
- data/lib/railway_ipc/models/consumed_message.rb +40 -35
- data/lib/railway_ipc/models/published_message.rb +11 -9
- data/lib/railway_ipc/publisher.rb +67 -16
- data/lib/railway_ipc/rabbitmq/adapter.rb +23 -15
- data/lib/railway_ipc/rabbitmq/payload.rb +9 -4
- data/lib/railway_ipc/railtie.rb +2 -0
- data/lib/railway_ipc/responder.rb +10 -3
- data/lib/railway_ipc/response.rb +4 -1
- data/lib/railway_ipc/rpc/client/client.rb +43 -18
- data/lib/railway_ipc/rpc/client/client_response_handlers.rb +2 -0
- data/lib/railway_ipc/rpc/client/errors/timeout_error.rb +2 -0
- data/lib/railway_ipc/rpc/concerns/error_adapter_configurable.rb +2 -0
- data/lib/railway_ipc/rpc/concerns/message_observation_configurable.rb +2 -0
- data/lib/railway_ipc/rpc/concerns/publish_location_configurable.rb +2 -0
- data/lib/railway_ipc/rpc/rpc.rb +2 -0
- data/lib/railway_ipc/rpc/server/server.rb +25 -7
- data/lib/railway_ipc/rpc/server/server_response_handlers.rb +2 -0
- data/lib/railway_ipc/tasks/generate_migrations.rake +16 -16
- data/lib/railway_ipc/tasks/start_consumers.rake +3 -1
- data/lib/railway_ipc/tasks/start_servers.rake +3 -1
- data/lib/railway_ipc/unhandled_message_error.rb +2 -0
- data/lib/railway_ipc/unknown_message.pb.rb +18 -0
- data/lib/railway_ipc/version.rb +3 -1
- data/priv/migrations/add_railway_ipc_consumed_messages.rb +5 -3
- data/priv/migrations/add_railway_ipc_published_messages.rb +3 -1
- data/railway_ipc.gemspec +34 -30
- metadata +62 -64
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/CHANGELOG.MD +0 -7
- data/Gemfile.lock +0 -186
- data/lib/railway_ipc/base_message.pb.rb +0 -21
- data/lib/railway_ipc/consumer/consumer_response_handlers.rb +0 -14
- data/lib/railway_ipc/handler_manifest.rb +0 -10
- data/lib/railway_ipc/null_handler.rb +0 -7
- data/lib/railway_ipc/null_message.rb +0 -7
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'google/protobuf'
|
4
|
+
|
5
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
6
|
+
add_message 'railway_ipc.messages.Unknown' do
|
7
|
+
optional :user_uuid, :string, 1
|
8
|
+
optional :correlation_id, :string, 2
|
9
|
+
optional :uuid, :string, 3
|
10
|
+
map :context, :string, :string, 4
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module RailwayIpc
|
15
|
+
module Messages
|
16
|
+
Unknown = Google::Protobuf::DescriptorPool.generated_pool.lookup('railway_ipc.messages.Unknown').msgclass
|
17
|
+
end
|
18
|
+
end
|
data/lib/railway_ipc/version.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class AddRailwayIpcConsumedMessages < ActiveRecord::Migration
|
2
4
|
def change
|
3
|
-
create_table :railway_ipc_consumed_messages
|
5
|
+
create_table :railway_ipc_consumed_messages do |t|
|
4
6
|
t.uuid :uuid, null: false
|
5
7
|
t.string :message_type
|
6
8
|
t.uuid :user_uuid
|
7
9
|
t.uuid :correlation_id
|
8
10
|
t.text :encoded_message
|
9
11
|
t.string :status, null: false
|
10
|
-
t.string :queue
|
12
|
+
t.string :queue, null: false
|
11
13
|
t.string :exchange
|
12
14
|
|
13
15
|
t.datetime :updated_at
|
14
16
|
t.datetime :inserted_at
|
15
17
|
end
|
16
18
|
|
17
|
-
add_index :railway_ipc_consumed_messages,
|
19
|
+
add_index :railway_ipc_consumed_messages, %i[uuid queue], unique: true
|
18
20
|
end
|
19
21
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class AddRailwayIpcPublishedMessages < ActiveRecord::Migration
|
2
4
|
def change
|
3
|
-
create_table :railway_ipc_published_messages, id: false do |
|
5
|
+
create_table :railway_ipc_published_messages, id: false do |t|
|
4
6
|
t.uuid :uuid, null: false
|
5
7
|
t.string :message_type
|
6
8
|
t.uuid :user_uuid
|
data/railway_ipc.gemspec
CHANGED
@@ -1,50 +1,54 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
5
|
+
require 'railway_ipc/version'
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
8
|
+
spec.name = 'railway-ipc'
|
7
9
|
spec.version = RailwayIpc::VERSION
|
8
|
-
spec.authors =
|
9
|
-
spec.email =
|
10
|
+
spec.authors = ''
|
11
|
+
spec.email = ''
|
12
|
+
spec.required_ruby_version = '>= 2.5'
|
10
13
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
14
|
+
spec.summary = 'IPC components for Rails'
|
15
|
+
spec.description = 'IPC components for Rails'
|
16
|
+
spec.homepage = 'http://learn.co'
|
17
|
+
spec.license = 'MIT'
|
15
18
|
|
16
19
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
20
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
21
|
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata[
|
22
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
20
23
|
else
|
21
|
-
raise
|
22
|
-
|
24
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
25
|
+
'public gem pushes.'
|
23
26
|
end
|
24
27
|
|
25
28
|
# Specify which files should be added to the gem when it is released.
|
26
29
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
-
spec.files = Dir.chdir(File.expand_path(
|
28
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(
|
30
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(/^(.circleci|.rspec|.rubocop.yml|test|spec|features)/) }
|
29
32
|
end
|
30
|
-
spec.bindir =
|
33
|
+
spec.bindir = 'exe'
|
31
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = [
|
35
|
+
spec.require_paths = ['lib']
|
36
|
+
|
37
|
+
spec.add_development_dependency 'bundler', '2.0.1'
|
38
|
+
spec.add_development_dependency 'factory_bot', '~> 5.1'
|
39
|
+
spec.add_development_dependency 'google-protobuf', '~> 3.9'
|
40
|
+
spec.add_development_dependency 'rake', '>= 10.0.0'
|
41
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
|
+
spec.add_development_dependency 'rubocop', '~> 0.86'
|
33
43
|
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
-
spec.add_development_dependency "factory_bot", "~> 5.1"
|
38
|
-
spec.add_development_dependency "pry-byebug", "3.4.2"
|
39
|
-
spec.add_development_dependency "google-protobuf", "~> 3.9"
|
40
|
-
spec.add_dependency "sneakers", "~> 2.3.5"
|
41
|
-
spec.add_dependency "bunny", "~> 2.2.0"
|
44
|
+
spec.add_dependency 'bunny', '~> 2.2.0'
|
45
|
+
spec.add_dependency 'sneakers', '~> 2.3.5'
|
42
46
|
|
43
47
|
# Setup for testing Rails type code within mock Rails app
|
44
|
-
spec.add_development_dependency
|
45
|
-
spec.add_development_dependency
|
46
|
-
spec.add_development_dependency
|
47
|
-
spec.add_development_dependency
|
48
|
-
spec.add_development_dependency
|
49
|
-
spec.add_development_dependency
|
48
|
+
spec.add_development_dependency 'database_cleaner', '~> 1.7'
|
49
|
+
spec.add_development_dependency 'listen', '~> 3.0.5'
|
50
|
+
spec.add_development_dependency 'pg', '~> 0.18'
|
51
|
+
spec.add_development_dependency 'rails', '~> 5.0.7'
|
52
|
+
spec.add_development_dependency 'rspec-rails'
|
53
|
+
spec.add_development_dependency 'shoulda-matchers', '~> 4.2'
|
50
54
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railway-ipc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 10.0.0
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 10.0.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,75 +25,75 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: 2.0.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: factory_bot
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
33
|
+
version: '5.1'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '5.1'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: google-protobuf
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '3.9'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '3.9'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 10.0.0
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 10.0.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: rspec
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
75
|
+
version: '3.0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
82
|
+
version: '3.0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: rubocop
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :
|
89
|
+
version: '0.86'
|
90
|
+
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
96
|
+
version: '0.86'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: bunny
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,33 +109,47 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 2.2.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: sneakers
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - "~>"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
117
|
+
version: 2.3.5
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.3.5
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: database_cleaner
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.7'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '1.7'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: listen
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 3.0.5
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 3.0.5
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pg
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,47 +165,47 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.18'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: rails
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 5.0.7
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 5.0.7
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: rspec-rails
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: '
|
187
|
+
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- - "
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
194
|
+
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: shoulda-matchers
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: '4.2'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: '4.2'
|
209
209
|
description: IPC components for Rails
|
210
210
|
email: ''
|
211
211
|
executables: []
|
@@ -213,31 +213,27 @@ extensions: []
|
|
213
213
|
extra_rdoc_files: []
|
214
214
|
files:
|
215
215
|
- ".gitignore"
|
216
|
-
-
|
217
|
-
- ".travis.yml"
|
218
|
-
- CHANGELOG.MD
|
216
|
+
- CHANGELOG.md
|
219
217
|
- CODE_OF_CONDUCT.md
|
220
218
|
- Gemfile
|
221
|
-
- Gemfile.lock
|
222
219
|
- LICENSE.txt
|
223
220
|
- README.md
|
224
221
|
- Rakefile
|
225
222
|
- bin/console
|
223
|
+
- bin/rspec
|
224
|
+
- bin/rubocop
|
226
225
|
- bin/setup
|
227
226
|
- lib/railway_ipc.rb
|
228
227
|
- lib/railway_ipc/Rakefile
|
229
|
-
- lib/railway_ipc/base_message.pb.rb
|
230
228
|
- lib/railway_ipc/consumer/consumer.rb
|
231
|
-
- lib/railway_ipc/consumer/
|
229
|
+
- lib/railway_ipc/consumer/process_incoming_message.rb
|
232
230
|
- lib/railway_ipc/errors.rb
|
233
231
|
- lib/railway_ipc/handler.rb
|
234
|
-
- lib/railway_ipc/handler_manifest.rb
|
235
232
|
- lib/railway_ipc/handler_store.rb
|
233
|
+
- lib/railway_ipc/incoming_message.rb
|
236
234
|
- lib/railway_ipc/logger.rb
|
237
235
|
- lib/railway_ipc/models/consumed_message.rb
|
238
236
|
- lib/railway_ipc/models/published_message.rb
|
239
|
-
- lib/railway_ipc/null_handler.rb
|
240
|
-
- lib/railway_ipc/null_message.rb
|
241
237
|
- lib/railway_ipc/publisher.rb
|
242
238
|
- lib/railway_ipc/rabbitmq/adapter.rb
|
243
239
|
- lib/railway_ipc/rabbitmq/payload.rb
|
@@ -257,6 +253,7 @@ files:
|
|
257
253
|
- lib/railway_ipc/tasks/start_consumers.rake
|
258
254
|
- lib/railway_ipc/tasks/start_servers.rake
|
259
255
|
- lib/railway_ipc/unhandled_message_error.rb
|
256
|
+
- lib/railway_ipc/unknown_message.pb.rb
|
260
257
|
- lib/railway_ipc/version.rb
|
261
258
|
- priv/migrations/add_railway_ipc_consumed_messages.rb
|
262
259
|
- priv/migrations/add_railway_ipc_published_messages.rb
|
@@ -274,14 +271,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
274
271
|
requirements:
|
275
272
|
- - ">="
|
276
273
|
- !ruby/object:Gem::Version
|
277
|
-
version: '
|
274
|
+
version: '2.5'
|
278
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
276
|
requirements:
|
280
277
|
- - ">="
|
281
278
|
- !ruby/object:Gem::Version
|
282
279
|
version: '0'
|
283
280
|
requirements: []
|
284
|
-
|
281
|
+
rubyforge_project:
|
282
|
+
rubygems_version: 2.7.6
|
285
283
|
signing_key:
|
286
284
|
specification_version: 4
|
287
285
|
summary: IPC components for Rails
|