sbmt-outbox 6.3.0 → 6.3.1

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: d936531e4d8411170774717a4a325846ee05ad292027285a8a6dd1a337c7bb9f
4
- data.tar.gz: 46a7e007d5f3be785b7616e0eb683354cbdb6654663f744914e3309441aa1a52
3
+ metadata.gz: 952db6c0164054fe8a19297680900749dacf124e2987d2a49a02304f4a02f0db
4
+ data.tar.gz: b765f1c66e936431070f61e946ac9a50b7b2b2966af01f124923c8cb5f70cdab
5
5
  SHA512:
6
- metadata.gz: 5ff4f4b9b1d3e5e9260b227b4781a66233908c36023cae98d4ab8344baa612b9f0195a02d930054fa3ecf51f256518c7d05a36083887eccc67cb39cb25592c67
7
- data.tar.gz: 52d88f0391854c934059f21daff079f242e736536efd4ac0bfad2edb7b595f4027c0b3bdf44dd469a6058e26d5a7e4f9c1d811793af0f8a2ebfaf370d0da1f25
6
+ metadata.gz: 2c6e1a536dc8ece25ceb807db39e1f4f52fa70f79d6eadfd834707da8d7f4593575cc0563e638133f973fa4205c8e9fe14f1e28ffbbe44bf1f5f35ec1748fb9a
7
+ data.tar.gz: f5b8196a367b1c38ed65fdaa95cecdd7dd245524c17e317088f73387ea114262d81ed1062b4f1486cf084f55e0a31b64b08999a0d42b30117e41c841bbb15012
data/README.md CHANGED
@@ -3,12 +3,12 @@
3
3
 
4
4
  # Sbmt-Outbox
5
5
 
6
+ <img src="https://raw.githubusercontent.com/SberMarket-Tech/sbmt-outbox/master/.github/outbox-logo.png" alt="sbmt-outbox logo" height="220" align="right" />
7
+
6
8
  Microservices often publish messages after a transaction has been committed. Writing to the database and publishing a message are two separate transactions, so they must be atomic. A failed publication of a message could lead to a critical failure of the business process.
7
9
 
8
10
  The Outbox pattern provides a reliable solution for message publishing. The idea behind this approach is to have an "outgoing message table" in the service's database. Before the main transaction completes, a new message row is added to this table. As a result, two actions take place as part of a single transaction. An asynchronous process retrieves new rows from the database table and, if they exist, publishes the messages to the broker.
9
11
 
10
- Read more about the Outbox pattern at https://microservices.io/patterns/data/transactional-outbox.html
11
-
12
12
  ## Installation
13
13
 
14
14
  Add this line to your application's Gemfile:
@@ -6,7 +6,7 @@ module Sbmt
6
6
  class InboxClassesController < BaseController
7
7
  def index
8
8
  render_list(Sbmt::Outbox.inbox_item_classes.map do |item|
9
- Sbmt::Outbox::Api::InboxClass.find_or_initialize(item.box_name)
9
+ Sbmt::Outbox::Api::InboxClass.find_or_initialize(item.box_id)
10
10
  end)
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Sbmt
6
6
  class OutboxClassesController < BaseController
7
7
  def index
8
8
  render_list(Sbmt::Outbox.outbox_item_classes.map do |item|
9
- Api::OutboxClass.find_or_initialize(item.box_name)
9
+ Api::OutboxClass.find_or_initialize(item.box_id)
10
10
  end)
11
11
  end
12
12
 
@@ -16,8 +16,12 @@ module Sbmt
16
16
  @box_name ||= name.underscore
17
17
  end
18
18
 
19
+ def box_id
20
+ @box_id ||= name.underscore.tr("/", "-").dasherize
21
+ end
22
+
19
23
  def config
20
- @config ||= lookup_config.new(box_name)
24
+ @config ||= lookup_config.new(box_id: box_id, box_name: box_name)
21
25
  end
22
26
 
23
27
  def calc_bucket_partitions(count)
@@ -8,7 +8,8 @@ module Sbmt
8
8
 
9
9
  delegate :yaml_config, :memory_store, to: "Sbmt::Outbox"
10
10
 
11
- def initialize(box_name)
11
+ def initialize(box_id:, box_name:)
12
+ self.box_id = box_id
12
13
  self.box_name = box_name
13
14
 
14
15
  validate!
@@ -109,7 +110,7 @@ module Sbmt
109
110
 
110
111
  private
111
112
 
112
- attr_accessor :box_name
113
+ attr_accessor :box_id, :box_name
113
114
 
114
115
  def options
115
116
  @options ||= lookup_config || {}
@@ -129,8 +130,8 @@ module Sbmt
129
130
  end
130
131
 
131
132
  def polling_enabled_for?(api_model)
132
- record = memory_store.fetch("sbmt/outbox/outbox_item_config/#{box_name}", expires_in: 10) do
133
- api_model.find(box_name)
133
+ record = memory_store.fetch("sbmt/outbox/outbox_item_config/#{box_id}", expires_in: 10) do
134
+ api_model.find(box_id)
134
135
  end
135
136
 
136
137
  if record.nil?
@@ -22,7 +22,7 @@ module Sbmt
22
22
  c.ui = ActiveSupport::OrderedOptions.new.tap do |c|
23
23
  c.serve_local = false
24
24
  c.local_endpoint = "http://localhost:5173"
25
- c.cdn_url = "https://cdn.jsdelivr.net/npm/sbmt-outbox-ui@0.0.7/dist/assets/index.js"
25
+ c.cdn_url = "https://cdn.jsdelivr.net/npm/sbmt-outbox-ui@0.0.8/dist/assets/index.js"
26
26
  end
27
27
  c.process_items = ActiveSupport::OrderedOptions.new.tap do |c|
28
28
  c.general_timeout = 120
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sbmt
4
4
  module Outbox
5
- VERSION = "6.3.0"
5
+ VERSION = "6.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbmt-outbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 6.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sbermarket Ruby-Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-23 00:00:00.000000000 Z
11
+ date: 2024-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool