bbk-app 1.1.0.199604 → 1.1.0.200186

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0b3be53f1520e37530b898c036f3ff2926aadc0dba02de4cd09a0db46f01c70
4
- data.tar.gz: 89b366aa046c1d159a192d70bafb5705fe2333b7e1c78ae5f0a03ddc66f773f5
3
+ metadata.gz: 0015bff7294750f2619f091dcd78733a7d57f7b8cce1cbf5f30740b387cd31de
4
+ data.tar.gz: 326e8891cc26e15c2f7264305edc7488444d9d1e0e5350a14d5fc6ebfa1b43e7
5
5
  SHA512:
6
- metadata.gz: ac133a5f83ef9c8744f811eda10066e8dd8e23caa79bdc5b9fd689fe01ef5740e1337633e5f796c4e6be9c638600fa7db49e419aa458fff668c342b15b8e8d1b
7
- data.tar.gz: 27cbe213fd2946740f25efbaa5f7c7226f3e2128750b8e48302e6e16917cc32b51da1f6c2e46c46273b9f6a4391f6a8b7fbfd7f6c0753766f620964761163bde
6
+ metadata.gz: 9b51c79011c934f623e631dc9a361f45010e52aee8ffa65f06a8d80705cda9769dc1d3f6448ee84ad17bc0caad68720f8103f8cce1b3a2d87dfc415b3603708c
7
+ data.tar.gz: b36a555638e1055f96bd9d5996b935c014d1f3d2050c4dccba8a5c3633cbae8f8ba252e64e6189141db8cb38a2de5c63021a19812e7c662c2674ffced62f9938
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bbk-app (1.1.0.199604)
4
+ bbk-app (1.1.0.200186)
5
5
  activesupport
6
6
  bbk-utils (> 1.0.1)
7
7
  timeouter
@@ -59,16 +59,6 @@ module BBK
59
59
  publishers << publisher
60
60
  end
61
61
 
62
- # set default publisher for results with empty scheme or DEFAULT_PROTOCOL scheme
63
- def default_publisher=(publisher)
64
- @default_publisher = publisher
65
- end
66
-
67
- # get default publisher
68
- def default_publisher
69
- @default_publisher || (publishers.size == 1 ? publishers.first : nil)
70
- end
71
-
72
62
  def register_middleware(middleware)
73
63
  middlewares << middleware
74
64
  end
@@ -222,10 +212,6 @@ module BBK
222
212
  route = result.route
223
213
  logger.debug "Publish result to #{route} ..."
224
214
  publisher = publishers.find {|pub| pub.protocols.include?(route.scheme) }
225
- if route.scheme.nil? || route.scheme == DEFAULT_PROTOCOL
226
- logger.debug "Use default publisher for result with route=#{route}"
227
- publisher = default_publisher
228
- end
229
215
  raise "Not found publisher for scheme #{route.scheme}" if publisher.nil?
230
216
 
231
217
  # return Concurrent::Promises.resolvable_future
@@ -0,0 +1,23 @@
1
+ module BBK
2
+ module App
3
+ module Domains
4
+ class ByBlock
5
+
6
+ attr_reader :name
7
+
8
+ def initialize(name, &block)
9
+ raise ArgumentError.new('no block') unless block_given?
10
+
11
+ @name = name
12
+ @block = block
13
+ end
14
+
15
+ def call(route)
16
+ @block.call(route)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,37 @@
1
+ require 'bbk/app/domains/by_block'
2
+
3
+ module BBK
4
+ module App
5
+ class DomainsSet
6
+ def initialize(*domains)
7
+ @domains = domains.map{|d| [d.name.to_s, d] }.to_h
8
+ end
9
+
10
+ # Get exchange name by domain
11
+ # @param domain_name [String] domain name
12
+ # @return [String] exchange name configured for passed domain name
13
+ def [](domain_name)
14
+ @domains[domain_name]
15
+ end
16
+
17
+ def add(domain)
18
+ @domains[domain.name.to_s] = domain
19
+ end
20
+
21
+ alias << add
22
+
23
+ # Each method implementation for object iteration
24
+ def each(&block)
25
+ @domains.values.each(&block)
26
+ end
27
+
28
+ # Check if store has information about domain
29
+ # @param domain_name [String] domain name
30
+ # @return [Boolean] has information about domain
31
+ def has?(domain_name)
32
+ @domains.key? domain_name
33
+ end
34
+
35
+ end
36
+ end
37
+ end
data/lib/bbk/app.rb CHANGED
@@ -5,6 +5,7 @@ require 'bbk/app/matchers'
5
5
  require 'bbk/app/middlewares'
6
6
  require 'bbk/app/dispatcher'
7
7
  require 'bbk/app/processors'
8
+ require 'bbk/app/domains_set'
8
9
  require 'bbk/utils/logger'
9
10
 
10
11
  module BBK
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbk-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.199604
4
+ version: 1.1.0.200186
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -267,6 +267,8 @@ files:
267
267
  - lib/bbk/app/dispatcher/queue_stream_strategy.rb
268
268
  - lib/bbk/app/dispatcher/result.rb
269
269
  - lib/bbk/app/dispatcher/route.rb
270
+ - lib/bbk/app/domains/by_block.rb
271
+ - lib/bbk/app/domains_set.rb
270
272
  - lib/bbk/app/factory.rb
271
273
  - lib/bbk/app/handler.rb
272
274
  - lib/bbk/app/matchers.rb