pub_sub_model_sync 1.3.0 → 1.3.1
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 +0 -2
- data/Gemfile.lock +1 -1
- data/README.md +6 -28
- data/Rakefile +1 -0
- data/lib/pub_sub_model_sync/service_google.rb +2 -2
- data/lib/pub_sub_model_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df220f5f010c22b60791382718383661ae2d4200bb63d4cf3e03a2b096cc740
|
4
|
+
data.tar.gz: 84244d1c98800f15d54e3fbfdd3897fa05aea6f7285a8da5f1fcfb67d61513be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb2df15c0f909204e165b6d4e69d97434fcd50bc3ce3169086840753879b5ca0bf4de3942da0354e2528a203563084258ab3c6b003969336ae12311105e3a316
|
7
|
+
data.tar.gz: d3f4660cc54518d11bb66880a9c99100eb9e757cc9c1087b8a4a59cff976178d3f9d5fe97beddac55395b392083a381df9828a8dace92087f129a7130265759f
|
data/.github/workflows/ruby.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -386,37 +386,15 @@ Note: To reduce Payload size, some header info are not delivered (Enable debug m
|
|
386
386
|
## **Testing with RSpec**
|
387
387
|
- Config: (spec/rails_helper.rb)
|
388
388
|
```ruby
|
389
|
-
|
390
|
-
# when using google service
|
391
|
-
require 'pub_sub_model_sync/mock_google_service'
|
392
|
-
config.before(:each) do
|
393
|
-
google_mock = PubSubModelSync::MockGoogleService.new
|
394
|
-
allow(Google::Cloud::Pubsub).to receive(:new).and_return(google_mock)
|
395
|
-
end
|
396
|
-
|
397
|
-
# when using rabbitmq service
|
398
|
-
require 'pub_sub_model_sync/mock_rabbit_service'
|
399
|
-
config.before(:each) do
|
400
|
-
rabbit_mock = PubSubModelSync::MockRabbitService.new
|
401
|
-
allow(Bunny).to receive(:new).and_return(rabbit_mock)
|
402
|
-
end
|
403
|
-
|
404
|
-
# when using apache kafka service
|
405
|
-
require 'pub_sub_model_sync/mock_kafka_service'
|
406
|
-
config.before(:each) do
|
407
|
-
kafka_mock = PubSubModelSync::MockKafkaService.new
|
408
|
-
allow(Kafka).to receive(:new).and_return(kafka_mock)
|
409
|
-
end
|
410
|
-
|
411
|
-
# disable all models sync by default (reduces testing time)
|
412
389
|
config.before(:each) do
|
413
|
-
|
414
|
-
allow(PubSubModelSync::MessagePublisher).to receive(:
|
390
|
+
# disable delivering notifications to pubsub
|
391
|
+
allow(PubSubModelSync::MessagePublisher).to receive(:connector_publish)
|
392
|
+
# disable all models sync by default (reduces testing time by avoiding to build payload data)
|
393
|
+
allow(PubSubModelSync::MessagePublisher).to receive(:publish_model)
|
415
394
|
end
|
416
395
|
|
417
396
|
# enable all models sync only for tests that includes 'sync: true'
|
418
397
|
config.before(:each, sync: true) do
|
419
|
-
allow(PubSubModelSync::MessagePublisher).to receive(:publish_data).and_call_original
|
420
398
|
allow(PubSubModelSync::MessagePublisher).to receive(:publish_model).and_call_original
|
421
399
|
end
|
422
400
|
|
@@ -426,9 +404,9 @@ Note: To reduce Payload size, some header info are not delivered (Enable debug m
|
|
426
404
|
# end
|
427
405
|
```
|
428
406
|
- Examples:
|
429
|
-
- **Publisher**
|
407
|
+
- **Publisher**
|
408
|
+
Note: **Do not forget to include 'sync: true'** to enable publishing pubsub notifications
|
430
409
|
```ruby
|
431
|
-
# Do not forget to include 'sync: true' to enable publishing pubsub notifications
|
432
410
|
describe 'When publishing sync', truncate: true, sync: true do
|
433
411
|
it 'publishes user notification when created' do
|
434
412
|
expect_publish_notification(:create, klass: 'User')
|
data/Rakefile
CHANGED
@@ -81,8 +81,8 @@ module PubSubModelSync
|
|
81
81
|
def subscribe_to_topics
|
82
82
|
topics.map do |key, topic|
|
83
83
|
subs_name = "#{config.subscription_key}_#{key}"
|
84
|
-
subscription = topic.subscription(subs_name) || topic.subscribe(subs_name, SUBSCRIPTION_SETTINGS)
|
85
|
-
subscriber = subscription.listen(LISTEN_SETTINGS, &method(:process_message))
|
84
|
+
subscription = topic.subscription(subs_name) || topic.subscribe(subs_name, **SUBSCRIPTION_SETTINGS)
|
85
|
+
subscriber = subscription.listen(**LISTEN_SETTINGS, &method(:process_message))
|
86
86
|
subscriber.start
|
87
87
|
log("Subscribed to topic: #{topic.name} as: #{subs_name}")
|
88
88
|
subscriber
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|