totoro 0.2.3 → 0.2.4

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: a926daef321f70159db769459276589c7138eaf27127ca1845c7abd2997e67a4
4
- data.tar.gz: 1da2986fe327d6a57695f264961d593bc88859a6eeb55677ae9ea6f8f839a58d
3
+ metadata.gz: 6bcf67a54e3430d56f804525a3ee9731008b194367f25fed929c47580a2c03f1
4
+ data.tar.gz: ff0ae95316f329cbbc9871c4e354c32764a6c0a1d15c791272b030798d7ce42e
5
5
  SHA512:
6
- metadata.gz: 4bf433447b6833bc64d511dee29816e94987e47f16b84dca726ec638cb5eea51aa3a32b974e7c9fb59de03a587522bdd7cee6b4f26849f195232a21b96080ce6
7
- data.tar.gz: 80bc27d3e4be414e3fc208d81948538dda15065b4a242bc6a7d0b4f2f524c220f9d6d5b0da2bc72331f4de87e7aae34c0d46c2fb4a0cc3a465ffd8838de22970
6
+ metadata.gz: 622ef851054883c47902772edc0f0e15ae8d7f55c0c81a4118cda3f8d1840ce4fcd69d043da6c804590438227914fc5ca54ac5799d32f86a82c3d5d73b1905f9
7
+ data.tar.gz: 3c7e47eaf077234773f36f860b04411ac05f87e5ca548ac24698a65b3d5357ed9fe0efd5d89408601d78344b617b984a7b72e964b357aaabb1e173186d578e2d
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+
2
+ Totoro:
3
+ ☐ Add log
4
+ ☐ flush log
data/docker-compose.yml CHANGED
@@ -25,7 +25,7 @@ services:
25
25
  ports:
26
26
  - '3000:3000'
27
27
  volumes:
28
- # - ./test/totoro_test:/app
28
+ - ./test/totoro_test:/app
29
29
  - .:/totoro
30
30
  command: ./bin/rails c
31
31
  environment:
@@ -23,6 +23,7 @@ module Totoro
23
23
 
24
24
  # enqueue = publish to direct exchange
25
25
  def enqueue(id, payload)
26
+ Rails.logger.info "#{queue.name} send message"
26
27
  queue = channel.queue(*config.queue(id))
27
28
  payload = JSON.dump payload
28
29
  exchange.publish(payload, routing_key: queue.name)
@@ -19,6 +19,7 @@ module Totoro
19
19
 
20
20
  def execute
21
21
  @queue_class.subscribe(@queue_name) do |delivery_info, metadata, payload|
22
+ Rails.logger.info "#{@queue_name} received message"
22
23
  payload_hash = JSON.parse(payload).with_indifferent_access
23
24
  process(payload_hash, metadata, delivery_info)
24
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Totoro
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
5
5
  end
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /totoro
3
3
  specs:
4
- totoro (0.1.5)
4
+ totoro (0.2.3)
5
5
  bunny (~> 2.10)
6
6
 
7
7
  GEM
@@ -47,7 +47,7 @@ GEM
47
47
  amq-protocol (2.3.0)
48
48
  arel (8.0.0)
49
49
  builder (3.2.3)
50
- bunny (2.10.0)
50
+ bunny (2.11.0)
51
51
  amq-protocol (~> 2.3.0)
52
52
  byebug (10.0.2)
53
53
  concurrent-ruby (1.0.5)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Worker
4
+ class ExampleQueue < Totoro::BaseWorker
5
+ setup queue_name: 'example_queue'
6
+ def process(payload, metadata, delivery_info)
7
+ # worker process
8
+ end
9
+ end
10
+ end
@@ -36,7 +36,7 @@ Rails.application.configure do
36
36
 
37
37
  # Raise an error on page load if there are pending migrations.
38
38
  config.active_record.migration_error = :page_load
39
-
39
+ config.logger = Logger.new(STDOUT)
40
40
 
41
41
  # Raises error for missing translations
42
42
  # config.action_view.raise_on_missing_translations = true
@@ -71,7 +71,6 @@ Rails.application.configure do
71
71
  # Use a different logger for distributed setups.
72
72
  # require 'syslog/logger'
73
73
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
74
-
75
74
  if ENV["RAILS_LOG_TO_STDOUT"].present?
76
75
  logger = ActiveSupport::Logger.new(STDOUT)
77
76
  logger.formatter = config.log_formatter
@@ -17,7 +17,6 @@ Rails.application.configure do
17
17
  config.public_file_server.headers = {
18
18
  'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19
19
  }
20
-
21
20
  # Show full error reports and disable caching.
22
21
  config.consider_all_requests_local = true
23
22
  config.action_controller.perform_caching = false
@@ -0,0 +1 @@
1
+ Totoro::Initializer.new.execute
@@ -0,0 +1,31 @@
1
+ default: &default
2
+ default:
3
+ connect:
4
+ host: rabbitmq
5
+ port: 5672
6
+ user: app
7
+ pass: app
8
+ queue:
9
+ example_queue:
10
+ name: real.queue.name
11
+ durable: true
12
+
13
+ custom:
14
+ connect:
15
+ host: rabbitmq
16
+ port: 5672
17
+ user: app
18
+ pass: app
19
+ queue:
20
+ custom_queue:
21
+ name: custom.queue.name
22
+ durable: true
23
+
24
+ development:
25
+ <<: *default
26
+
27
+ test:
28
+ <<: *default
29
+
30
+ production:
31
+ <<: *default
@@ -0,0 +1 @@
1
+ huishu
@@ -0,0 +1 @@
1
+ E, [2018-07-23T04:24:19.172785 #25] ERROR -- : huishu
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: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShuHui18
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -81,6 +81,7 @@ files:
81
81
  - LICENSE.txt
82
82
  - README.md
83
83
  - Rakefile
84
+ - TODO
84
85
  - bin/console
85
86
  - bin/setup
86
87
  - bin/totoro
@@ -98,6 +99,7 @@ files:
98
99
  - lib/totoro/initializer.rb
99
100
  - lib/totoro/version.rb
100
101
  - pkg/totoro-0.2.2.gem
102
+ - pkg/totoro-0.2.3.gem
101
103
  - spec/spec_helper.rb
102
104
  - spec/totoro_spec.rb
103
105
  - test/totoro_test/Gemfile
@@ -110,6 +112,7 @@ files:
110
112
  - test/totoro_test/app/jobs/application_job.rb
111
113
  - test/totoro_test/app/mailers/application_mailer.rb
112
114
  - test/totoro_test/app/models/application_record.rb
115
+ - test/totoro_test/app/models/worker/example_queue.rb
113
116
  - test/totoro_test/app/views/layouts/mailer.html.erb
114
117
  - test/totoro_test/app/views/layouts/mailer.text.erb
115
118
  - test/totoro_test/bin/bundle
@@ -133,13 +136,17 @@ files:
133
136
  - test/totoro_test/config/initializers/filter_parameter_logging.rb
134
137
  - test/totoro_test/config/initializers/inflections.rb
135
138
  - test/totoro_test/config/initializers/mime_types.rb
139
+ - test/totoro_test/config/initializers/totoro.rb
136
140
  - test/totoro_test/config/initializers/wrap_parameters.rb
137
141
  - test/totoro_test/config/locales/en.yml
138
142
  - test/totoro_test/config/puma.rb
139
143
  - test/totoro_test/config/routes.rb
140
144
  - test/totoro_test/config/secrets.yml
141
145
  - test/totoro_test/config/spring.rb
146
+ - test/totoro_test/config/totoro.yml
142
147
  - test/totoro_test/db/seeds.rb
148
+ - test/totoro_test/log/development.log
149
+ - test/totoro_test/log/production.log
143
150
  - test/totoro_test/public/robots.txt
144
151
  - test/totoro_test/test/test_helper.rb
145
152
  - totoro.gemspec