legion-transport 1.1.4 → 1.1.5

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: a14303eeb59f5d328dba4782a6fcab96087a63403fa7e734fa98738c6010fccd
4
- data.tar.gz: 3c30d91267de37a9f04e721755dd5452a9dcb8c6ff649c9a17ce0b941893be5d
3
+ metadata.gz: ff91b1e257e5a3be9580e01bb3517deab0f5f912f031e081469034643e7b1f7a
4
+ data.tar.gz: f940e2c6821e2015fb29e7d32746d53deaf36ad2fdc8c238c0ee519852b0710c
5
5
  SHA512:
6
- metadata.gz: b4e78c019c6ae475aa18cb82108c024d9df78f84d46073cdfcbbffafc2b1ac393e255052f4036a3311f652f01269aa1cfe7e636b6153c30b0c32cf11825e4622
7
- data.tar.gz: f42031b318d1e491fff023496c379c323e8ec81aebe750d0291b8bdf0b6c1f361fd99b0d60804ba0814023b560f2e6ca3c76c00e845472cbf60ba54a9fbdc97e
6
+ metadata.gz: 379c26d17de282b5342a4300197658ce222a822c2bbe10cffc4f459b7bb13689fe1b145e60237c9579bef58005e37ee60d85c9f18e23292791bfdbddb608604b
7
+ data.tar.gz: d25558b9a4e10049ba187b4174bebf0e198e1914f08422db97ae79090a67e1150b8b9e5f1b795f55030bf3e2a4a0386ae10b67c1c9a19cddcf83fc67ddc6bba3
@@ -11,9 +11,7 @@ module Legion
11
11
  def publish(options = @options) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
12
12
  raise unless @valid
13
13
 
14
- $exchanges = {} if $exchanges.nil?
15
- $exchanges[exchange.to_s] = exchange.new unless $exchanges.key?(exchange.to_s)
16
- exchange_dest = $exchanges[exchange.to_s]
14
+ exchange_dest = exchange.respond_to?(:new) ? exchange.new : exchange
17
15
  exchange_dest.publish(encode_message,
18
16
  routing_key: routing_key || '',
19
17
  content_type: options[:content_type] || content_type,
@@ -7,7 +7,8 @@ module Legion::Transport::Messages # rubocop:disable Style/ClassAndModuleChildre
7
7
  end
8
8
 
9
9
  def message
10
- { args: @options[:args] || @options }
10
+ { args: @options[:args] || @options,
11
+ function: function.values[:name] }
11
12
  end
12
13
 
13
14
  def routing_key
@@ -16,6 +16,17 @@ module Legion
16
16
  }
17
17
  end
18
18
 
19
+ def routing_key # rubocop:disable Metrics/AbcSize
20
+ if @options[:conditions].is_a?(String) && @options[:conditions].length > 2
21
+ 'task.subtask.conditioner'
22
+ elsif @options[:transformation].is_a?(String) && @options[:transformation].length > 2
23
+ 'task.subtask.transform'
24
+ elsif @options[:function_id].is_a? Integer
25
+ function = Legion::Data::Model::Function[@options[:function_id]]
26
+ "#{function.runner.extension.values[:exchange]}.#{function.runner.values[:queue]}.#{function.values[:name]}"
27
+ end
28
+ end
29
+
19
30
  def validate
20
31
  raise TypeError unless @options[:function].is_a? String
21
32
 
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Transport
3
- VERSION = '1.1.4'.freeze
3
+ VERSION = '1.1.5'.freeze
4
4
  end
5
5
  end
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.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-14 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler