pub_sub_model_sync 1.2.1 → 1.3.0
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 +4 -4
- data/.github/workflows/ruby.yml +7 -1
- data/gemfiles/Gemfile_4 +0 -1
- data/gemfiles/Gemfile_7 +14 -0
- data/lib/pub_sub_model_sync/message_publisher.rb +1 -1
- data/lib/pub_sub_model_sync/version.rb +1 -1
- data/samples/README.md +17 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e02077ac63ab98c674a0071b440c77da2e269109d8768c738b82362379e2c921
|
4
|
+
data.tar.gz: 0d29b69fb65290be2a7a437b87b04d53e4c8a394c98775eb1c98e20d96936866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8877f20626a3404f8bb13a897d9e4d5fc28761a18e1cd88253d6210c323d25ac3c793c742ededb2ca11c5500b6997d5cf2c176300b444528ee206f6fdf3f0b
|
7
|
+
data.tar.gz: ae8f2610ee4778746b11781cd2f3b1e2bc97352989cc300cbc95b5884568b73f8f9f431d0d2c36d64f720fc777c21897e3f9e579d38e1b622da860dff8a2d75c
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,14 +12,20 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
|
-
ruby: [2.
|
15
|
+
ruby: [2.5, 2.6]
|
16
16
|
rails: [4, 5, 6]
|
17
17
|
include:
|
18
18
|
- ruby: 2.7
|
19
19
|
rails: 6
|
20
|
+
- ruby: '3.0'
|
21
|
+
rails: 6
|
22
|
+
- ruby: '3.0'
|
23
|
+
rails: 7
|
20
24
|
exclude: # rails 6 requires ruby >= 2.5
|
21
25
|
- ruby: 2.4
|
22
26
|
rails: 6
|
27
|
+
- ruby: '3.0'
|
28
|
+
rails: 7
|
23
29
|
|
24
30
|
steps:
|
25
31
|
- uses: actions/checkout@v2
|
data/gemfiles/Gemfile_4
CHANGED
data/gemfiles/Gemfile_7
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem 'rubocop'
|
4
|
+
gem 'bunny' # rabbit-mq
|
5
|
+
gem 'google-cloud-pubsub' # google pub/sub
|
6
|
+
gem 'ruby-kafka' # kafka pub/sub
|
7
|
+
gem 'rails', '~> 7'
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem 'database_cleaner-active_record'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Specify your gem's dependencies in pub_sub_model_sync.gemspec
|
14
|
+
gemspec
|
@@ -34,7 +34,7 @@ module PubSubModelSync
|
|
34
34
|
# @param key (String, Nil)
|
35
35
|
# @return (Transaction)
|
36
36
|
def init_transaction(key, settings = {})
|
37
|
-
new_transaction = PubSubModelSync::Transaction.new(key, settings)
|
37
|
+
new_transaction = PubSubModelSync::Transaction.new(key, **settings)
|
38
38
|
if current_transaction
|
39
39
|
current_transaction.add_transaction(new_transaction)
|
40
40
|
else
|
data/samples/README.md
CHANGED
@@ -2,13 +2,27 @@
|
|
2
2
|
This is a sample to sync information between rails applications using RabbitMQ
|
3
3
|
|
4
4
|
## Installation
|
5
|
-
|
5
|
+
1. Create manually the required network to share rabbitMQ accross Rails applications (just if not exist):
|
6
6
|
```docker network create shared_app_services```
|
7
7
|
|
8
|
-
|
8
|
+
2. Start RabbitMQ server
|
9
9
|
```cd samples/app1 && docker-compose up pubsub```
|
10
10
|
|
11
|
-
|
11
|
+
3. In another tab access to App2 to listen notifications (Wait for step 2)
|
12
|
+
- Access to the folder
|
13
|
+
`cd samples/app2`
|
14
|
+
|
15
|
+
- Build docker and start listener (Received notifications will be printed here)
|
16
|
+
```docker-compose run listener```
|
17
|
+
|
18
|
+
- Optional: Open another tab to access application to ensure synced data
|
19
|
+
```docker-compose run listener bash -c "rails c```
|
20
|
+
```ruby
|
21
|
+
user = User.last.inspect
|
22
|
+
user.posts.inspect
|
23
|
+
```
|
24
|
+
|
25
|
+
4. In another tab access to App1 to publish notifications (Wait for step 2)
|
12
26
|
- Access to the application
|
13
27
|
`cd samples/app1`
|
14
28
|
|
@@ -33,18 +47,4 @@ This is a sample to sync information between rails applications using RabbitMQ
|
|
33
47
|
```ruby
|
34
48
|
user.destroy!
|
35
49
|
```
|
36
|
-
|
37
|
-
* In another tab access to App2 to listen notifications (Wait for step 2)
|
38
|
-
- Access to the folder
|
39
|
-
`cd samples/app2`
|
40
|
-
|
41
|
-
- Build docker and start listener (Received notifications will be printed here)
|
42
|
-
```docker-compose run listener```
|
43
50
|
|
44
|
-
- Optional: Open another tab to access application to ensure synced data
|
45
|
-
```docker-compose run listener bash -c "rails c```
|
46
|
-
```ruby
|
47
|
-
user = User.last.inspect
|
48
|
-
user.posts.inspect
|
49
|
-
```
|
50
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pub_sub_model_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- gemfiles/Gemfile_4
|
108
108
|
- gemfiles/Gemfile_5
|
109
109
|
- gemfiles/Gemfile_6
|
110
|
+
- gemfiles/Gemfile_7
|
110
111
|
- lib/pub_sub_model_sync.rb
|
111
112
|
- lib/pub_sub_model_sync/base.rb
|
112
113
|
- lib/pub_sub_model_sync/config.rb
|