totoro 1.0.2 → 1.0.3

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: 8452f7f479fd1933359f70bdde0120906ab884a8a07800a43250404af3995f6c
4
- data.tar.gz: 704a3128522d2fc71cc02a181b9005c792bcec481e200c3189b49d489abade50
3
+ metadata.gz: 19763f23001b05dcb72f6af2e44c533da4b7f297945c1073b0e46086e122fd21
4
+ data.tar.gz: eb012a5806d7494dc2f033d6f6b223579b9e4d35355ce93da7e10a914195f4c2
5
5
  SHA512:
6
- metadata.gz: 75449c3700e1d8adaf6d944cbed64318942333403b565f81dd4bcd7dbded855fb4cf56e3551d695d1a68d0b213370d57de8b972a8d0cff44ca05d2e850c4516d
7
- data.tar.gz: 3bcd7229e11842bf69d610b76a6454d8033c26d70eabdf104a772acff80c4a461ba865e55223f14b1c40afd8992de40f7eb6cb82a6f960661b945a2d18a8ff6d
6
+ metadata.gz: bbd7442af6046ffe82472e84299d52e34d706161dd25b313e3f76cdd080fef43f03cbd9c4dfa3dd0f137e2c352f8849348c06c4d8ed76a12de2def01f0fc868c
7
+ data.tar.gz: 62c9608d8de53ef43f9d80cb97ab45a12d647cf5f7d85cde54b261ff5ec10a21eb417aa9c42a4b701632c1d2bffda383b164ca0719ac84ac35e91fbb1422e307
data/README.md CHANGED
@@ -31,6 +31,49 @@ This command will generate two files
31
31
  #### Run DB migraion
32
32
  `rake db:migrate`
33
33
 
34
+ ## Sample configuration
35
+
36
+ ```yaml
37
+ default: &default
38
+ default:
39
+ connect:
40
+ host: rabbitmq
41
+ port: 5672
42
+ user: app
43
+ pass: app
44
+ queue:
45
+ normal_queue_for_both_enqueue_and_subscribe:
46
+ name: default_exchange.queue.name
47
+ durable: true
48
+ exchange_queue_for_subscribe:
49
+ name: fanout.exchange.queue
50
+ durable: true
51
+ exchange: fanout.exchange.name
52
+ exchange:
53
+ exchange_for_fanout_enqueue:
54
+ name: fanout.exchange.name
55
+
56
+ custom:
57
+ connect:
58
+ host: rabbitmq
59
+ port: 5672
60
+ user: app
61
+ pass: app
62
+ queue:
63
+ custom_queue:
64
+ name: custom.queue.name
65
+ durable: true
66
+
67
+ development:
68
+ <<: *default
69
+
70
+ test:
71
+ <<: *default
72
+
73
+ production:
74
+ <<: *default
75
+
76
+ ```
34
77
  ## Quick Start
35
78
 
36
79
  ### Resend Failed messages daemon
@@ -42,7 +85,13 @@ Please run `rake totoro:resend_msg` before you start your app.
42
85
  #### Enqueue
43
86
 
44
87
  ```
45
- Totoro::Queue.enqueue('queue', payload)
88
+ Totoro::Queue.enqueue('queue_id', payload)
89
+ ```
90
+
91
+ #### BroadCast (Enqueue to fanout exchange)
92
+
93
+ ```
94
+ Totoro::Queue.broadcast('exchange_id', payload)
46
95
  ```
47
96
 
48
97
  #### Dequeue
@@ -68,6 +117,12 @@ bundle exec totoro worker_class
68
117
 
69
118
  ### Custom rabbitmq server
70
119
 
120
+ When you have more than one rabbitmq server to connect, you need to add custom configuration.
121
+
122
+ To use the custom rabbitmq server you need to add `ServerName` between `Totoro` and `Queue`
123
+
124
+ For example:
125
+
71
126
  #### Enqueue
72
127
 
73
128
  ```
@@ -21,7 +21,7 @@ module Totoro
21
21
  Rails.logger.info 'Listening to the Rabbitmq'
22
22
  STDOUT.flush
23
23
  subscribe_service.subscribe(@queue_name) do |delivery_info, metadata, payload|
24
- Rails.logger.info "#{@queue_name} received message"
24
+ Rails.logger.debug "#{@queue_name} received message"
25
25
  STDOUT.flush
26
26
  payload_hash = JSON.parse(payload).with_indifferent_access
27
27
  process(payload_hash, metadata, delivery_info)
@@ -12,7 +12,7 @@ module Totoro
12
12
  exchange = channel.fanout(@config.exchange(exchange_id))
13
13
  payload = JSON.dump payload
14
14
  exchange.publish(payload)
15
- Rails.logger.info "send message to exchange #{@config.exchange(exchange_id)}"
15
+ Rails.logger.debug "send message to exchange #{@config.exchange(exchange_id)}"
16
16
  STDOUT.flush
17
17
  channel.close
18
18
  rescue Bunny::TCPConnectionFailedForAllHosts,
@@ -12,7 +12,7 @@ module Totoro
12
12
  queue = channel.queue(*@config.queue(id))
13
13
  payload = JSON.dump payload
14
14
  exchange.publish(payload, routing_key: queue.name)
15
- Rails.logger.info "send message to #{queue.name}"
15
+ Rails.logger.debug "send message to #{queue.name}"
16
16
  STDOUT.flush
17
17
  channel.close
18
18
  rescue Bunny::TCPConnectionFailedForAllHosts,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Totoro
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /totoro
3
3
  specs:
4
- totoro (1.0.0)
4
+ totoro (1.0.2)
5
5
  bunny (~> 2.10)
6
6
  delayed_job_active_record (~> 4.1.3)
7
7
  delayed_job_recurring (~> 0.3.7)
@@ -9,39 +9,39 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.1.6)
13
- actionpack (= 5.1.6)
12
+ actioncable (5.1.6.1)
13
+ actionpack (= 5.1.6.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.6)
17
- actionpack (= 5.1.6)
18
- actionview (= 5.1.6)
19
- activejob (= 5.1.6)
16
+ actionmailer (5.1.6.1)
17
+ actionpack (= 5.1.6.1)
18
+ actionview (= 5.1.6.1)
19
+ activejob (= 5.1.6.1)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.1.6)
23
- actionview (= 5.1.6)
24
- activesupport (= 5.1.6)
22
+ actionpack (5.1.6.1)
23
+ actionview (= 5.1.6.1)
24
+ activesupport (= 5.1.6.1)
25
25
  rack (~> 2.0)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.6)
30
- activesupport (= 5.1.6)
29
+ actionview (5.1.6.1)
30
+ activesupport (= 5.1.6.1)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.6)
36
- activesupport (= 5.1.6)
35
+ activejob (5.1.6.1)
36
+ activesupport (= 5.1.6.1)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.1.6)
39
- activesupport (= 5.1.6)
40
- activerecord (5.1.6)
41
- activemodel (= 5.1.6)
42
- activesupport (= 5.1.6)
38
+ activemodel (5.1.6.1)
39
+ activesupport (= 5.1.6.1)
40
+ activerecord (5.1.6.1)
41
+ activemodel (= 5.1.6.1)
42
+ activesupport (= 5.1.6.1)
43
43
  arel (~> 8.0)
44
- activesupport (5.1.6)
44
+ activesupport (5.1.6.1)
45
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
46
46
  i18n (>= 0.7, < 2)
47
47
  minitest (~> 5.1)
@@ -52,70 +52,70 @@ GEM
52
52
  bunny (2.13.0)
53
53
  amq-protocol (~> 2.3, >= 2.3.0)
54
54
  byebug (10.0.2)
55
- concurrent-ruby (1.0.5)
55
+ concurrent-ruby (1.1.4)
56
56
  crass (1.0.4)
57
57
  delayed_job (4.1.5)
58
58
  activesupport (>= 3.0, < 5.3)
59
59
  delayed_job_active_record (4.1.3)
60
60
  activerecord (>= 3.0, < 5.3)
61
61
  delayed_job (>= 3.0, < 5)
62
- delayed_job_recurring (0.3.7)
62
+ delayed_job_recurring (0.3.8)
63
63
  delayed_job (>= 3.0)
64
64
  delayed_job_active_record
65
- erubi (1.7.1)
66
- ffi (1.9.25)
65
+ erubi (1.8.0)
66
+ ffi (1.10.0)
67
67
  globalid (0.4.1)
68
68
  activesupport (>= 4.2.0)
69
- i18n (1.1.0)
69
+ i18n (1.5.1)
70
70
  concurrent-ruby (~> 1.0)
71
71
  listen (3.1.5)
72
72
  rb-fsevent (~> 0.9, >= 0.9.4)
73
73
  rb-inotify (~> 0.9, >= 0.9.7)
74
74
  ruby_dep (~> 1.2)
75
- loofah (2.2.2)
75
+ loofah (2.2.3)
76
76
  crass (~> 1.0.2)
77
77
  nokogiri (>= 1.5.9)
78
- mail (2.7.0)
78
+ mail (2.7.1)
79
79
  mini_mime (>= 0.1.1)
80
- method_source (0.9.0)
81
- mini_mime (1.0.0)
82
- mini_portile2 (2.3.0)
80
+ method_source (0.9.2)
81
+ mini_mime (1.0.1)
82
+ mini_portile2 (2.4.0)
83
83
  minitest (5.11.3)
84
84
  nio4r (2.3.1)
85
- nokogiri (1.8.4)
86
- mini_portile2 (~> 2.3.0)
87
- pg (1.1.3)
85
+ nokogiri (1.10.0)
86
+ mini_portile2 (~> 2.4.0)
87
+ pg (1.1.4)
88
88
  puma (3.12.0)
89
- rack (2.0.5)
89
+ rack (2.0.6)
90
90
  rack-test (1.1.0)
91
91
  rack (>= 1.0, < 3)
92
- rails (5.1.6)
93
- actioncable (= 5.1.6)
94
- actionmailer (= 5.1.6)
95
- actionpack (= 5.1.6)
96
- actionview (= 5.1.6)
97
- activejob (= 5.1.6)
98
- activemodel (= 5.1.6)
99
- activerecord (= 5.1.6)
100
- activesupport (= 5.1.6)
92
+ rails (5.1.6.1)
93
+ actioncable (= 5.1.6.1)
94
+ actionmailer (= 5.1.6.1)
95
+ actionpack (= 5.1.6.1)
96
+ actionview (= 5.1.6.1)
97
+ activejob (= 5.1.6.1)
98
+ activemodel (= 5.1.6.1)
99
+ activerecord (= 5.1.6.1)
100
+ activesupport (= 5.1.6.1)
101
101
  bundler (>= 1.3.0)
102
- railties (= 5.1.6)
102
+ railties (= 5.1.6.1)
103
103
  sprockets-rails (>= 2.0.0)
104
104
  rails-dom-testing (2.0.3)
105
105
  activesupport (>= 4.2.0)
106
106
  nokogiri (>= 1.6)
107
107
  rails-html-sanitizer (1.0.4)
108
108
  loofah (~> 2.2, >= 2.2.2)
109
- railties (5.1.6)
110
- actionpack (= 5.1.6)
111
- activesupport (= 5.1.6)
109
+ railties (5.1.6.1)
110
+ actionpack (= 5.1.6.1)
111
+ activesupport (= 5.1.6.1)
112
112
  method_source
113
113
  rake (>= 0.8.7)
114
114
  thor (>= 0.18.1, < 2.0)
115
- rake (12.3.1)
115
+ rake (12.3.2)
116
116
  rb-fsevent (0.10.3)
117
- rb-inotify (0.9.10)
118
- ffi (>= 0.5.0, < 2)
117
+ rb-inotify (0.10.0)
118
+ ffi (~> 1.0)
119
119
  ruby_dep (1.5.0)
120
120
  spring (2.0.2)
121
121
  activesupport (>= 4.2)
@@ -129,7 +129,7 @@ GEM
129
129
  actionpack (>= 4.0)
130
130
  activesupport (>= 4.0)
131
131
  sprockets (>= 3.0.0)
132
- thor (0.20.0)
132
+ thor (0.20.3)
133
133
  thread_safe (0.3.6)
134
134
  tzinfo (1.2.5)
135
135
  thread_safe (~> 0.1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShuHui18
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -139,6 +139,7 @@ files:
139
139
  - lib/totoro/tasks/resend_message.rake
140
140
  - lib/totoro/utils.rb
141
141
  - lib/totoro/version.rb
142
+ - pkg/totoro-1.0.3.gem
142
143
  - spec/spec_helper.rb
143
144
  - spec/totoro_spec.rb
144
145
  - test/rabbitmq_commands.txt
@@ -189,13 +190,11 @@ files:
189
190
  - test/totoro_test/config/secrets.yml
190
191
  - test/totoro_test/config/spring.rb
191
192
  - test/totoro_test/config/totoro.yml
192
- - test/totoro_test/db/development.sqlite3
193
193
  - test/totoro_test/db/migrate/20181019041208_create_delayed_jobs.rb
194
194
  - test/totoro_test/db/migrate/20181019070846_create_totoro_failed_messages.rb
195
195
  - test/totoro_test/db/migrate/20181228033422_update_totoro_failed_messages.rb
196
196
  - test/totoro_test/db/schema.rb
197
197
  - test/totoro_test/db/seeds.rb
198
- - test/totoro_test/db/test.sqlite3
199
198
  - test/totoro_test/public/robots.txt
200
199
  - test/totoro_test/test/test_helper.rb
201
200
  - totoro.gemspec
File without changes