totoro 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/totoro/message_resender.rb +5 -3
- data/lib/totoro/version.rb +1 -1
- data/pkg/totoro-0.5.0.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 887b647ac10b4602521547775e3450f3e494e49485c7ff6561c40254c4ee70cf
|
4
|
+
data.tar.gz: 01c4d423e603bc23493af121bfdbaa0417d45742888d66e731dab9a46fe12281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccedd69d1b6bd85bedc5176582fac0a113dd9353038a33f9a110b0d612e6fd5c3f050ed96bd70cadb83e07dbda414fed762e5b7c60e28e9662c0303af4679f6e
|
7
|
+
data.tar.gz: 3039126bb7eb21598857427d0e3f388d826f163ef40113bc3cd1a2ede2b46e726756d18164c35e3050f7124c91421b1a8e8810f44d6cd040a5f88233b6d374fc
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# Totoro, a RabbitMQ Util
|
2
2
|
|
3
3
|
Totoro is a RabbitMQ util that focuses on samplify queue operation.
|
4
|
-
|
4
|
+
## Dependencies
|
5
|
+
Please install [Delayed Job active record](https://rubygems.org/gems/delayed_job_active_record) and [Delayed Job recurring](https://rubygems.org/gems/delayed_job_recurring) before use Totoro.
|
6
|
+
Totoro basically use delayed job to cache and resend falied messages.
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
### Install gem
|
@@ -24,9 +26,17 @@ This command will generate two files
|
|
24
26
|
|
25
27
|
1. `totoro.yml` (Rabbitmq configuration file)
|
26
28
|
2. `initilizers/totoro.rb` (Rails initializer)
|
29
|
+
3. `db/migrate/[tiemstamp]_create_totoro_failed_messages.rb` (DB migration to create messages caching table)
|
30
|
+
|
31
|
+
#### Run DB migraion
|
32
|
+
`rake db:migrate`
|
27
33
|
|
28
34
|
## Quick Start
|
29
35
|
|
36
|
+
### Resend Failed messages daemon
|
37
|
+
|
38
|
+
Please run `rake totoro:resend_msg` before you start your app.
|
39
|
+
|
30
40
|
### Default rabbitmq server
|
31
41
|
|
32
42
|
#### Enqueue
|
@@ -9,9 +9,11 @@ module Totoro
|
|
9
9
|
queue 'totoro'
|
10
10
|
def perform
|
11
11
|
Totoro::Queue.connection
|
12
|
-
Totoro::TotoroFailedMessage.
|
13
|
-
|
14
|
-
|
12
|
+
Totoro::TotoroFailedMessage.find_in_batches(batch_size: 100) do |message_group|
|
13
|
+
message_group.each do |m|
|
14
|
+
m.class_name.constantize.enqueue(m.queue_id, m.payload)
|
15
|
+
m.destroy
|
16
|
+
end
|
15
17
|
end
|
16
18
|
rescue Bunny::TCPConnectionFailedForAllHosts => error
|
17
19
|
Rails.logger.error error.message
|
data/lib/totoro/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totoro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShuHui18
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/totoro/tasks/resend_message.rake
|
132
132
|
- lib/totoro/totoro_failed_message.rb
|
133
133
|
- lib/totoro/version.rb
|
134
|
+
- pkg/totoro-0.5.0.gem
|
134
135
|
- spec/spec_helper.rb
|
135
136
|
- spec/totoro_spec.rb
|
136
137
|
- test/totoro_test/Gemfile
|