Skip to content

Commit

Permalink
feat: update outbox
Browse files Browse the repository at this point in the history
  • Loading branch information
bibendi committed Mar 29, 2024
1 parent 9e75c2d commit 6f35d6f
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 54 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ curl -X POST -L http://quest.lvh.me/api/v1/orders/ORDER-ID/completion
```shell
curl -L http://voyage.lvh.me/api/v1/orders/ORDER-ID
```

## Troubleshooting

Sometimes Kafka broker doesn't receive a message into the topic. In this case:
- stop all applications with `dip down`
- stop infra containers with `dip infra down`
- delete kafka volumes with `docker volume rm dip-infra-kafka-latest_kafka dip-infra-kafka-latest_zookeeper`
2 changes: 1 addition & 1 deletion quest/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ gem "http_health_check"
gem "strong_migrations"
gem "rails_semantic_logger"

# Sbermarket Tech gems
# SbermarketTech gems
gem "sbmt-outbox"
gem "sbmt-kafka_producer"

Expand Down
42 changes: 21 additions & 21 deletions quest/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ GEM
ruby-next-core (~> 1.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.6)
bigdecimal (3.1.7)
builder (3.2.4)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
Expand All @@ -94,8 +94,7 @@ GEM
dotenv-rails (3.1.0)
dotenv (= 3.1.0)
railties (>= 6.1)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
Expand Down Expand Up @@ -164,11 +163,11 @@ GEM
http_health_check (0.5.0)
rack (~> 2.0)
webrick
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
io-console (0.7.2)
irb (1.11.2)
irb (1.12.0)
rdoc
reline (>= 0.4.2)
json (2.7.1)
Expand All @@ -193,10 +192,10 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.3)
marcel (1.0.4)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
minitest (5.22.3)
mutex_m (0.2.0)
nanoid (2.0.0)
net-imap (0.4.10)
Expand All @@ -206,19 +205,19 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2)
nio4r (2.7.1)
nokogiri (1.16.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.2-aarch64-linux)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm64-darwin)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-darwin)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.0.5)
Expand All @@ -234,7 +233,7 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
Expand Down Expand Up @@ -284,16 +283,16 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rb_sys (0.9.89)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis-client (0.21.1)
connection_pool
redlock (2.0.6)
redis-client (>= 0.14.1, < 1.0.0)
regexp_parser (2.9.0)
reline (0.4.3)
reline (0.5.0)
io-console (~> 0.5)
rexml (3.2.6)
rspec (3.13.0)
Expand Down Expand Up @@ -350,20 +349,20 @@ GEM
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-limiter (2.3.0)
ruby-next-core (1.0.2)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
sbmt-kafka_producer (2.0.0)
sbmt-kafka_producer (2.1.0)
anyway_config (~> 2.4)
connection_pool
dry-initializer (~> 3.0)
dry-struct
waterdrop (~> 2.5)
yabeda (>= 0.11)
zeitwerk (~> 2.6)
sbmt-outbox (5.0.1)
sbmt-outbox (6.0.1)
connection_pool (~> 2.0)
cutoff (~> 0.5)
dry-initializer (~> 3.0)
Expand All @@ -373,6 +372,7 @@ GEM
rails (>= 5.2, < 8)
redis-client (>= 0.14.1, < 1.0.0)
redlock (> 1.0, < 3.0)
ruby-limiter (~> 2.3)
thor (>= 0.20, < 2)
yabeda (~> 0.8)
schked (1.3.0)
Expand Down
1 change: 1 addition & 0 deletions quest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ It allows you to learn how to use the Outbox pattern and how it works with Ruby
1. Install deps and prepare DB

```shell
dip infra up
dip provision
```

Expand Down
4 changes: 0 additions & 4 deletions quest/config/outbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ default: &default

outbox_items:
order_outbox_item:
partition_size: <%= ENV.fetch('QUEST__ORDER_OUTBOX_ITEM__PARTITION_SIZE'){ '2' } %>
partition_strategy: hash
retention: P3D
max_retries: <%= ENV.fetch('QUEST__ORDER_OUTBOX_ITEM__MAX_RETRIES'){ '7' } %>
retry_strategies:
- exponential_backoff
- compacted_log
transports:
sbmt/kafka_producer:
topic: <%= ENV.fetch('QUEST__KAFKA__TOPICS__ORDERS'){ 'yc.quest-stand.orders.0' } %>
Expand Down
2 changes: 1 addition & 1 deletion voyage/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gem "strong_migrations"
gem "rails_semantic_logger"
gem "pagy", "~> 6.0"

# Sbermarket Tech gems
# SbermarketTech gems
gem "sbmt-outbox"
gem "sbmt-kafka_consumer"

Expand Down
44 changes: 22 additions & 22 deletions voyage/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ GEM
ruby-next-core (~> 1.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.6)
bigdecimal (3.1.7)
builder (3.2.4)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
Expand All @@ -94,8 +94,7 @@ GEM
dotenv-rails (3.1.0)
dotenv (= 3.1.0)
railties (>= 6.1)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
Expand Down Expand Up @@ -168,11 +167,11 @@ GEM
http_health_check (0.5.0)
rack (~> 2.0)
webrick
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
io-console (0.7.2)
irb (1.11.2)
irb (1.12.0)
rdoc
reline (>= 0.4.2)
json (2.7.1)
Expand Down Expand Up @@ -201,10 +200,10 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.3)
marcel (1.0.4)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
minitest (5.22.3)
mutex_m (0.2.0)
nanoid (2.0.0)
net-imap (0.4.10)
Expand All @@ -214,23 +213,23 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2)
nio4r (2.7.1)
nokogiri (1.16.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.2-aarch64-linux)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm-linux)
nokogiri (1.16.3-arm-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm64-darwin)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86-linux)
nokogiri (1.16.3-x86-linux)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-darwin)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
pagy (6.5.0)
parallel (1.24.0)
Expand All @@ -255,7 +254,7 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
Expand Down Expand Up @@ -305,16 +304,16 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rb_sys (0.9.89)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis-client (0.21.1)
connection_pool
redlock (2.0.6)
redis-client (>= 0.14.1, < 1.0.0)
regexp_parser (2.9.0)
reline (0.4.3)
reline (0.5.0)
io-console (~> 0.5)
rexml (3.2.6)
rspec (3.13.0)
Expand Down Expand Up @@ -371,9 +370,9 @@ GEM
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-limiter (2.3.0)
ruby-next-core (1.0.2)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
sbmt-kafka_consumer (2.0.0)
Expand All @@ -384,7 +383,7 @@ GEM
thor
yabeda (>= 0.11)
zeitwerk (~> 2.3)
sbmt-outbox (5.0.1)
sbmt-outbox (6.0.1)
connection_pool (~> 2.0)
cutoff (~> 0.5)
dry-initializer (~> 3.0)
Expand All @@ -394,6 +393,7 @@ GEM
rails (>= 5.2, < 8)
redis-client (>= 0.14.1, < 1.0.0)
redlock (> 1.0, < 3.0)
ruby-limiter (~> 2.3)
thor (>= 0.20, < 2)
yabeda (~> 0.8)
schked (1.3.0)
Expand Down
1 change: 1 addition & 0 deletions voyage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ It allows you to learn how to use the Outbox pattern and how it works with Ruby
1. Install deps and prepare DB

```shell
dip infra up
dip provision
```

Expand Down
6 changes: 1 addition & 5 deletions voyage/config/outbox.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
default: &default
owner: "@ruby-platform" # Your team name in Mattermost
bucket_size: 16
probes:
port: <%= ENV.fetch("HEALTH_CHECK_PORT"){ 5555 } %>

inbox_items:
order_inbox_item:
partition_size: <%= ENV.fetch('VOYAGE__ORDER_INBOX_ITEM__PARTITION_SIZE'){ '1' } %>
partition_strategy: number
partition_strategy: hash
retention: P3D
max_retries: <%= ENV.fetch('VOYAGE__ORDER_INBOX_ITEM__MAX_RETRIES'){ '7' } %>
retry_strategies:
- exponential_backoff
transports:
inbox_importers:
target: order
Expand Down

0 comments on commit 6f35d6f

Please sign in to comment.