legion-transport 1.0.0 → 1.1.0

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: 4b8ebe4ac7e742ce233b6a34093a8b98d9edae6fd93a15bc1f0de46aedd0ae03
4
- data.tar.gz: 24574a28c192e3f79da7b36b33e19de1b93550162f58ecdd0df136892a7aee1d
3
+ metadata.gz: 98309d8f3163d1bdba7ca88d6bb959ae5a5d6773e1cc002949dc280bf73d2e36
4
+ data.tar.gz: 39548d7f549e30d06fc028a78e77e30c55553e6d6b2d30054c1c9c453b1930e9
5
5
  SHA512:
6
- metadata.gz: 4b956aeca717ed356ea934f07f2a3ec58ae30da3d5b3aa3fe39b6e2968cda9f0ee42843751abefa120942c4ffd2df7f4f53bdd8cb5bb51c05e91ac65200d4299
7
- data.tar.gz: 6165b84e313abce9a15e7126e6cae813323bc3ac4969bf8c7aba2e72c6e201e8d864e47d9125dfe8c216f78a50a728f7898634de20fd2967e532c7955637d4da
6
+ metadata.gz: b2fbcaab7ed6fffe61b70ffcccd49241b5deabefb61d5c8c3dc496ce8e06a69248bf9883f8f84fa81b7da56c8e866be888de6a3d0dfda038ae1c21a5126a848e
7
+ data.tar.gz: a2738a6e3f83b4f70ba0f16e4809e977209ddbd1eed110fd0267c9ea17326b5a813f88abc3b432a79a20f45eef28b1350b14a98e95b63d8ba9f8bca3f98394d0
@@ -1,116 +1,89 @@
1
- version: 2 # use CircleCI 2.0
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@0.2.1
4
+ sonarcloud: sonarsource/sonarcloud@1.0.1
5
+
2
6
  jobs:
3
7
  "rubocop":
4
8
  docker:
5
- - image: circleci/ruby:2.4-node
9
+ - image: circleci/ruby:2.7-node
6
10
  steps:
7
11
  - checkout
8
- - run: gem install rubocop
12
+ - ruby/load-cache
13
+ - ruby/install-deps
9
14
  - run:
10
15
  name: Run Rubocop
11
- command: rubocop
12
- - store_test_results:
13
- path: test_results
14
- "ruby-two-three":
16
+ command: bundle exec rubocop
17
+ - ruby/save-cache
18
+ "ruby-two-five":
15
19
  docker:
16
- - image: circleci/ruby:2.3
20
+ - image: circleci/ruby:2.5
17
21
  - image: rabbitmq:3.7
18
22
  steps:
19
23
  - checkout
24
+ - ruby/load-cache
20
25
  - run:
21
- name: Bundle Install
22
- command: bundle install
23
- - run:
24
- name: Run RSpec
25
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
26
- when: always
27
- - store_test_results:
28
- path: test-results
29
-
30
- "ruby-two-four":
26
+ name: update bundler
27
+ command: gem update bundler
28
+ - ruby/install-deps
29
+ - ruby/run-tests
30
+ - ruby/save-cache
31
+ "ruby-two-six":
31
32
  docker:
32
- - image: circleci/ruby:2.4-node
33
+ - image: circleci/ruby:2.6
33
34
  - image: rabbitmq:3.7
34
35
  steps:
35
36
  - checkout
37
+ - ruby/load-cache
36
38
  - run:
37
- name: Bundle Install
38
- command: bundle install
39
- - run:
40
- name: Run RSpec
41
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
42
- when: always
43
- - store_test_results:
44
- path: test-results
45
- "ruby-two-five":
39
+ name: update bundler
40
+ command: gem update bundler
41
+ - ruby/install-deps
42
+ - ruby/run-tests
43
+ - ruby/save-cache
44
+ "ruby-two-seven":
46
45
  docker:
47
- - image: circleci/ruby:2.5-node
46
+ - image: circleci/ruby:2.7
48
47
  - image: rabbitmq:3.7
49
48
  steps:
50
49
  - checkout
50
+ - ruby/load-cache
51
51
  - run:
52
- name: Bundle Install
53
- command: bundle install
54
- - run:
55
- name: Run RSpec
56
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
57
- when: always
58
- - store_test_results:
59
- path: test-results
60
- "ruby-two-six":
52
+ name: update bundler
53
+ command: gem update bundler
54
+ - ruby/install-deps
55
+ - ruby/run-tests
56
+ - ruby/save-cache
57
+ "sonarcloud":
61
58
  docker:
62
- - image: circleci/ruby:2.6-node
59
+ - image: circleci/ruby:2.7
63
60
  - image: rabbitmq:3.7
64
61
  steps:
65
62
  - checkout
63
+ - ruby/load-cache
64
+ - ruby/install-deps
65
+ - ruby/run-tests
66
66
  - run:
67
- name: Bundle Install
68
- command: bundle install
69
- - run:
70
- name: Run RSpec
71
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
72
- when: always
73
- - store_test_results:
74
- path: test-results
75
- "jruby-nine-two":
76
- docker:
77
- - image: circleci/jruby:9.2
78
- - image: rabbitmq:3.7
79
- steps:
80
- - checkout
81
- - run:
82
- name: Bundle Install
83
- command: bundle install
84
- - run:
85
- name: Run RSpec
86
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
87
- when: always
88
- - store_test_results:
89
- path: test-results
67
+ name: Run Rubocop
68
+ command: bundle exec rubocop --format=json --out=rubocop-result.json
69
+ - sonarcloud/scan
70
+ - ruby/save-cache
90
71
 
91
72
  workflows:
92
73
  version: 2
93
- cop_rake_deploy:
74
+ rubocop-rspec:
94
75
  jobs:
95
76
  - rubocop
96
- - ruby-two-three:
97
- requires:
98
- - ruby-two-four
99
- filters:
100
- branches:
101
- only: /\bdevelop\b|\bmaster\b/
102
- - ruby-two-four:
103
- requires:
104
- - rubocop
105
77
  - ruby-two-five:
106
78
  requires:
107
- - ruby-two-four
108
- filters:
109
- branches:
110
- only: /\bdevelop\b|\bmaster\b/
79
+ - rubocop
111
80
  - ruby-two-six:
112
81
  requires:
113
- - ruby-two-four
114
- filters:
115
- branches:
116
- only: /\bdevelop\b|\bmaster\b/
82
+ - ruby-two-five
83
+ - ruby-two-seven:
84
+ requires:
85
+ - ruby-two-five
86
+ - sonarcloud:
87
+ requires:
88
+ - ruby-two-seven
89
+ - ruby-two-six
@@ -7,39 +7,40 @@
7
7
  <content url="file://$MODULE_DIR$">
8
8
  <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
9
9
  </content>
10
- <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.7.0" jdkType="RUBY_SDK" />
11
11
  <orderEntry type="sourceFolder" forTests="false" />
12
- <orderEntry type="library" scope="PROVIDED" name="amq-protocol (v2.3.0, RVM: ruby-2.6.3) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.0, RVM: ruby-2.6.3) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="bunny (v2.14.4, RVM: ruby-2.6.3) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="codecov (v0.1.16, RVM: ruby-2.6.3) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, RVM: ruby-2.6.3) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby-ext (v1.1.6, RVM: ruby-2.6.3) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.3) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="jaro_winkler (v1.5.4, RVM: ruby-2.6.3) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="json (v2.3.0, RVM: ruby-2.6.3) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="legion-json (v0.1.6, RVM: ruby-2.6.3) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="legion-logging (v1.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="legion-settings (v1.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="oj (v3.10.5, RVM: ruby-2.6.3) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.1, RVM: ruby-2.6.3) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="parser (v2.7.0.4, RVM: ruby-2.6.3) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.6.3) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.4, RVM: ruby-2.6.3) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="rspec_junit_formatter (v0.4.1, RVM: ruby-2.6.3) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.80.1, RVM: ruby-2.6.3) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.6.3) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.18.5, RVM: ruby-2.6.3) [gem]" level="application" />
41
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.2, RVM: ruby-2.6.3) [gem]" level="application" />
42
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.6.1, RVM: ruby-2.6.3) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="url (v0.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="amq-protocol (v2.3.2, RVM: ruby-2.7.0) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.1, RVM: ruby-2.7.0) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.7.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bunny (v2.15.0, RVM: ruby-2.7.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="chef (v16.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="codecov (v0.2.2, RVM: ruby-2.7.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, RVM: ruby-2.7.0) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, RVM: ruby-2.7.0) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.3.1, RVM: ruby-2.7.0) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="legion-json (v1.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="legion-logging (v1.0.0, RVM: ruby-2.7.0) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="legion-settings (v1.1.0, RVM: ruby-2.7.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.15.0, RVM: ruby-2.7.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.2, RVM: ruby-2.7.0) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="parser (v2.7.1.4, RVM: ruby-2.7.0) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.7.0) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.7.0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v1.7.1, RVM: ruby-2.7.0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.4, RVM: ruby-2.7.0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.7.0) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, RVM: ruby-2.7.0) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, RVM: ruby-2.7.0) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.7.0) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, RVM: ruby-2.7.0) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="rspec_junit_formatter (v0.4.1, RVM: ruby-2.7.0) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.88.0, RVM: ruby-2.7.0) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v0.2.0, RVM: ruby-2.7.0) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.7.0) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.18.5, RVM: ruby-2.7.0) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.2, RVM: ruby-2.7.0) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.7.0, RVM: ruby-2.7.0) [gem]" level="application" />
44
45
  </component>
45
46
  </module>
@@ -1,4 +1,4 @@
1
- Metrics/LineLength:
1
+ Layout/LineLength:
2
2
  Max: 120
3
3
  Metrics/MethodLength:
4
4
  Max: 30
@@ -14,6 +14,7 @@ Style/Documentation:
14
14
  Enabled: false
15
15
  AllCops:
16
16
  TargetRubyVersion: 2.5
17
+ NewCops: enable
17
18
  Style/FrozenStringLiteralComment:
18
19
  Enabled: false
19
20
  Naming/FileName:
@@ -1,4 +1,4 @@
1
- image: ruby:2.4.0
1
+ image: ruby:2.5.0
2
2
 
3
3
  pipelines:
4
4
  branches:
@@ -22,27 +22,23 @@ Gem::Specification.new do |spec|
22
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
23
  f.match(%r{^(test|spec|features)/})
24
24
  end
25
- spec.bindir = 'exe'
26
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
26
  spec.require_paths = ['lib']
28
27
 
29
28
  spec.add_development_dependency 'bundler'
30
29
  spec.add_development_dependency 'codecov'
30
+ spec.add_development_dependency 'legion-logging'
31
+ spec.add_development_dependency 'legion-settings'
31
32
  spec.add_development_dependency 'rake', '~> 10.0'
32
33
  spec.add_development_dependency 'rspec', '~> 3.0'
33
34
  spec.add_development_dependency 'rspec_junit_formatter'
34
35
  spec.add_development_dependency 'rubocop'
35
36
  spec.add_development_dependency 'simplecov'
36
37
  spec.add_dependency 'concurrent-ruby'
37
- spec.add_dependency 'concurrent-ruby-ext'
38
38
 
39
39
  if RUBY_ENGINE == 'jruby'
40
- spec.add_development_dependency 'legion-settings-java'
41
40
  spec.add_dependency 'march_hare'
42
41
  else
43
- spec.add_development_dependency 'legion-settings'
44
42
  spec.add_dependency 'bunny'
45
43
  end
46
-
47
- spec.add_development_dependency 'legion-logging'
48
44
  end
@@ -8,7 +8,7 @@ module Legion
8
8
  Legion::Transport::CONNECTOR
9
9
  end
10
10
 
11
- def setup
11
+ def setup # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
12
12
  if @session.respond_to?(:value) && session.respond_to?(:closed?) && session.closed?
13
13
  @channel_thread = Concurrent::ThreadLocalVar.new
14
14
  elsif @session.respond_to?(:value) && session.respond_to?(:closed?) && session.open?
@@ -17,7 +17,8 @@ module Legion
17
17
  @session ||= Concurrent::Atom.new(
18
18
  connector.new(
19
19
  Legion::Settings[:transport][:connection],
20
- logger: Legion::Logging::Logger.new(level: 'warn'), log_level: :info
20
+ logger: Legion::Logging::Logger.new(level: 'warn'),
21
+ log_level: :info
21
22
  )
22
23
  )
23
24
  @channel_thread = Concurrent::ThreadLocalVar.new
@@ -3,6 +3,7 @@ module Legion
3
3
  class Consumer < Legion::Transport::CONNECTOR::Consumer
4
4
  include Legion::Transport::Common
5
5
  attr_reader :consumer_tag
6
+
6
7
  def initialize(queue:, no_ack: false, exclusive: false, consumer_tag: generate_consumer_tag, **opts)
7
8
  @consumer_tag = consumer_tag
8
9
  super(channel, queue, consumer_tag, no_ack, exclusive, opts)
@@ -8,7 +8,7 @@ module Legion
8
8
  validate
9
9
  end
10
10
 
11
- def publish(options = @options)
11
+ def publish(options = @options) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
12
12
  raise unless @valid
13
13
 
14
14
  exchange_dest = exchange.respond_to?(:new) ? exchange.new : exchange
@@ -1,6 +1,7 @@
1
- module Legion::Transport::Messages
1
+ module Legion::Transport::Messages # rubocop:disable Style/ClassAndModuleChildren
2
2
  class Dynamic < Legion::Transport::Message
3
3
  attr_accessor :options
4
+
4
5
  def type
5
6
  'task'
6
7
  end
@@ -1,4 +1,4 @@
1
- module Legion::Transport::Messages
1
+ module Legion::Transport::Messages # rubocop:disable Style/ClassAndModuleChildren
2
2
  class RequestClusterSecret < Legion::Transport::Message
3
3
  def routing_key
4
4
  'node.crypt.push_cluster_secret'
@@ -16,7 +16,7 @@ module Legion
16
16
  }
17
17
  end
18
18
 
19
- def routing_key
19
+ def routing_key # rubocop:disable Metrics/AbcSize
20
20
  if @options[:conditions].is_a?(String) && @options[:conditions].length > 2
21
21
  'task.subtask.conditioner'
22
22
  elsif @options[:transformation].is_a?(String) && @options[:transformation].length > 2
@@ -23,8 +23,7 @@ module Legion
23
23
  conditioner = ['conditioner.queued', 'conditioner.failed', 'conditioner.exception']
24
24
  transformer = ['transformer.queued', 'transformer.succeeded', 'transformer.exception']
25
25
  task = ['task.scheduled', 'task.queued', 'task.completed', 'task.exception', 'task.delayed']
26
- status = conditioner + transformer + task
27
- status
26
+ conditioner + transformer + task
28
27
  end
29
28
  end
30
29
  end
@@ -25,10 +25,12 @@ module Legion
25
25
  hash[:durable] = true
26
26
  hash[:exclusive] = false
27
27
  hash[:block] = false
28
- hash[:auto_delete] = false
29
- hash[:arguments] = { 'x-max-priority': 255,
30
- 'x-overflow': 'reject-publish',
31
- 'x-dead-letter-exchange': "#{self.class.ancestors.first.to_s.split('::')[2].downcase}.dlx" }
28
+ hash[:auto_delete] = true
29
+ hash[:arguments] = {
30
+ 'x-max-priority': 255,
31
+ 'x-overflow': 'reject-publish',
32
+ 'x-dead-letter-exchange': "#{self.class.ancestors.first.to_s.split('::')[2].downcase}.dlx"
33
+ }
32
34
  hash
33
35
  end
34
36
 
@@ -36,7 +38,7 @@ module Legion
36
38
  {}
37
39
  end
38
40
 
39
- def queue_name
41
+ def queue_name # rubocop:disable Metrics/AbcSize
40
42
  ancestor = self.class.ancestors.first.to_s.split('::')
41
43
  name = if ancestor[5].scan(/[A-Z]/).length > 1
42
44
  ancestor[5].gsub!(/(.)([A-Z])/, '\1_\2').downcase!
@@ -0,0 +1,21 @@
1
+ module Legion
2
+ module Transport
3
+ module Queues
4
+ class NodeCrypt < Legion::Transport::Queue
5
+ def queue_name
6
+ 'node.status'
7
+ end
8
+
9
+ def queue_options
10
+ hash = {}
11
+ hash[:manual_ack] = true
12
+ hash[:durable] = true
13
+ hash[:exclusive] = false
14
+ hash[:block] = false
15
+ hash[:arguments] = { 'x-dead-letter-exchange': 'node.dlx' }
16
+ hash
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,5 @@
1
+ require 'legion/settings'
2
+
1
3
  module Legion
2
4
  module Transport
3
5
  module Settings
@@ -14,15 +16,17 @@ module Legion
14
16
  password: 'guest',
15
17
  host: '127.0.0.1',
16
18
  port: '5672',
17
- vhost: 'legion',
19
+ vhost: '/',
18
20
  recovery_attempts: 0,
19
21
  logger_level: 'info'
20
22
  }.merge(grab_vault_creds)
21
23
  end
22
24
 
23
25
  def self.grab_vault_creds
24
- {} unless Legion::Settings[:vault][:connected]
25
- lease = Legion::Crypt.read('rabbitmq/creds/legion')
26
+ return {} unless Legion::Settings[:crypt][:vault][:connected]
27
+
28
+ lease = Legion::Crypt.read('rabbitmq/creds/legion', type: nil)
29
+ Legion::Logging.debug 'successfully grabbed amqp username from Vault'
26
30
  { user: lease[:username], password: lease[:password] }
27
31
  rescue StandardError
28
32
  {}
@@ -61,4 +65,8 @@ module Legion
61
65
  end
62
66
  end
63
67
 
64
- Legion::Settings.merge_settings('transport', Legion::Transport::Settings.default) if Legion.const_defined?('Settings')
68
+ begin
69
+ Legion::Settings.merge_settings('transport', Legion::Transport::Settings.default) if Legion.const_defined?('Settings')
70
+ rescue StandardError => e
71
+ Legion::Logging.fatal(e.message) if Legion::Logging.method_defined?(:fatal)
72
+ end
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Transport
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -1,9 +1,5 @@
1
- {"transport": {
2
- "rabbitmq": {
3
- "host": "localhost",
4
- "vhost": "legion",
5
- "user": "guest",
6
- "password": "guest"
1
+ {
2
+ "transport": {
3
+ "vhost": "/"
7
4
  }
8
5
  }
9
- }
@@ -0,0 +1,12 @@
1
+ sonar.projectKey=legion-io_legion-transport
2
+ sonar.organization=legion-io
3
+ sonar.projectName=Legion::Transport
4
+ sonar.sources=.
5
+ sonar.exclusions=vendor/**
6
+ sonar.coverage.exclusions=spec/**
7
+ sonar.ruby.coverage.reportPath=coverage/.resultset.json
8
+ sonar.ruby.file.suffixes=rb,ruby
9
+ sonar.ruby.coverage.framework=RSpec
10
+ sonar.ruby.rubocopConfig=.rubocop.yml
11
+ sonar.ruby.rubocop.reportPath=rubocop-result.json
12
+ sonar.ruby.rubocop.filePath=.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,35 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
42
+ name: legion-logging
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '3.0'
47
+ version: '0'
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: '3.0'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rspec_junit_formatter
56
+ name: legion-settings
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -81,41 +67,41 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rubocop
70
+ name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ">="
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: '10.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: '0'
82
+ version: '10.0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: simplecov
84
+ name: rspec
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - ">="
87
+ - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '0'
89
+ version: '3.0'
104
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: '0'
96
+ version: '3.0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: concurrent-ruby
98
+ name: rspec_junit_formatter
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
- type: :runtime
104
+ type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
@@ -123,13 +109,13 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: concurrent-ruby-ext
112
+ name: rubocop
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
130
116
  - !ruby/object:Gem::Version
131
117
  version: '0'
132
- type: :runtime
118
+ type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: legion-settings
126
+ name: simplecov
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -151,7 +137,7 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: bunny
140
+ name: concurrent-ruby
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - ">="
@@ -165,13 +151,13 @@ dependencies:
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
- name: legion-logging
154
+ name: bunny
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
157
  - - ">="
172
158
  - !ruby/object:Gem::Version
173
159
  version: '0'
174
- type: :development
160
+ type: :runtime
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
@@ -197,6 +183,7 @@ files:
197
183
  - ".rubocop.yml"
198
184
  - CHANGELOG.md
199
185
  - Gemfile
186
+ - Gemfile.lock
200
187
  - README.md
201
188
  - Rakefile
202
189
  - bin/console
@@ -223,12 +210,14 @@ files:
223
210
  - lib/legion/transport/messages/task_update.rb
224
211
  - lib/legion/transport/queue.rb
225
212
  - lib/legion/transport/queues/node.rb
213
+ - lib/legion/transport/queues/node_crypt.rb
226
214
  - lib/legion/transport/queues/node_status.rb
227
215
  - lib/legion/transport/queues/task_log.rb
228
216
  - lib/legion/transport/queues/task_update.rb
229
217
  - lib/legion/transport/settings.rb
230
218
  - lib/legion/transport/version.rb
231
219
  - settings/transport.json
220
+ - sonar-project.properties
232
221
  homepage: https://bitbucket.org/legion-io/legion-transport
233
222
  licenses: []
234
223
  metadata:
@@ -236,7 +225,7 @@ metadata:
236
225
  changelog_uri: https://bitbucket.org/legion-io/legion-transport/src/master/CHANGELOG.md
237
226
  homepage_uri: https://bitbucket.org/legion-io/legion-transport
238
227
  wiki_uri: https://bitbucket.org/legion-io/legion-transport/wiki/Home
239
- post_install_message:
228
+ post_install_message:
240
229
  rdoc_options: []
241
230
  require_paths:
242
231
  - lib
@@ -251,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
240
  - !ruby/object:Gem::Version
252
241
  version: '0'
253
242
  requirements: []
254
- rubygems_version: 3.0.8
255
- signing_key:
243
+ rubygems_version: 3.1.2
244
+ signing_key:
256
245
  specification_version: 4
257
246
  summary: Used by Legion to connect with RabbitMQ
258
247
  test_files: []