rt-tackle 0.8.0 → 0.8.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/README.md +72 -17
- data/lib/tackle/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb7fcc50f104dade384ab9e3090d1edc68c8c6e
|
4
|
+
data.tar.gz: 87865b2ef1bea50c964d75cc79302a7aa29b9157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6daaaaaab58645d5a22450790a7f44e30304ac68329bec4369d2024f790e5d39a0f6812e26a981ffb3d1bb4c356f14606523d0ecf4ccbd347965beb1ce4fead
|
7
|
+
data.tar.gz: 8760c4719ebb9c953fbb8e6aa30a65de5e4332a7a956fb32c1c51906f822952883096769e1982e5154f534d8e80092b4153e415afb00c1561e3e30ed2568bda4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Tackle
|
2
2
|
|
3
|
-
[](https://semaphoreci.com/renderedtext/tackle)
|
4
4
|
|
5
5
|
Tackles the problem of processing asynchronous jobs in reliable manner
|
6
6
|
by relying on RabbitMQ.
|
@@ -15,42 +15,97 @@ gem "rt-tackle", :require => "tackle"
|
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
18
|
-
###
|
18
|
+
### Publishing a message
|
19
|
+
|
20
|
+
With tackle, you can publish a message to an AMQP exchange. For example, to
|
21
|
+
publish `"Hello World!"` do the following:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
options = {
|
25
|
+
:url => "amqp://localhost",
|
26
|
+
:exchange => "test-exchange",
|
27
|
+
:routing_key => "test-messages",
|
28
|
+
}
|
29
|
+
|
30
|
+
Tackle.publish("Hello World!", options)
|
31
|
+
```
|
32
|
+
|
33
|
+
Optionally, you can pass a dedicated logger to the publish method. This comes
|
34
|
+
handy if you want to log the status of your publish action to a file.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
options = {
|
38
|
+
:url => "amqp://localhost",
|
39
|
+
:exchange => "test-exchange",
|
40
|
+
:routing_key => "test-messages",
|
41
|
+
:logger => Logger.new("publish.log")
|
42
|
+
}
|
43
|
+
|
44
|
+
Tackle.publish("Hello World!", options)
|
45
|
+
```
|
46
|
+
|
47
|
+
### Subscribe to an exchange
|
48
|
+
|
49
|
+
To consume messages from an exchange, do the following:
|
19
50
|
|
20
51
|
```ruby
|
21
52
|
require "tackle"
|
22
53
|
|
23
54
|
options = {
|
24
|
-
:url
|
25
|
-
:exchange
|
26
|
-
:routing_key => "test-messages",
|
27
|
-
:queue
|
28
|
-
:retry_limit => 8, # optional
|
29
|
-
:retry_delay => 30, # optional
|
30
|
-
:logger => Logger.new(STDOUT) # optional
|
55
|
+
:url => "amqp://localhost",
|
56
|
+
:exchange => "test-exchange",
|
57
|
+
:routing_key => "test-messages",
|
58
|
+
:queue => "test-queue"
|
31
59
|
}
|
32
60
|
|
33
61
|
Tackle.subscribe(options) do |message|
|
34
|
-
|
62
|
+
puts message
|
35
63
|
end
|
36
64
|
```
|
37
65
|
|
38
|
-
|
66
|
+
By default, tackle will retry any message that fails to be consumed. To
|
67
|
+
configure the retry limit and the delay in which the messages will be retried,
|
68
|
+
do the following:
|
39
69
|
|
40
70
|
```ruby
|
71
|
+
require "tackle"
|
41
72
|
|
42
73
|
options = {
|
43
|
-
:url
|
44
|
-
:exchange
|
45
|
-
:routing_key => "test-messages",
|
46
|
-
:
|
74
|
+
:url => "amqp://localhost",
|
75
|
+
:exchange => "test-exchange",
|
76
|
+
:routing_key => "test-messages",
|
77
|
+
:queue => "test-queue",
|
78
|
+
:retry_limit => 8,
|
79
|
+
:retry_delay => 30
|
47
80
|
}
|
48
81
|
|
49
|
-
Tackle.
|
82
|
+
Tackle.subscribe(options) do |message|
|
83
|
+
puts message
|
84
|
+
end
|
50
85
|
```
|
51
86
|
|
52
|
-
|
87
|
+
Tackle uses the `STDOUT` by default to trace the state of incoming messages. You
|
88
|
+
can pass a dedicated logger to the `subscribe` method to redirect the output:
|
53
89
|
|
90
|
+
```ruby
|
91
|
+
require "tackle"
|
92
|
+
|
93
|
+
options = {
|
94
|
+
:url => "amqp://localhost",
|
95
|
+
:exchange => "test-exchange",
|
96
|
+
:routing_key => "test-messages",
|
97
|
+
:queue => "test-queue",
|
98
|
+
:retry_limit => 8,
|
99
|
+
:retry_delay => 30,
|
100
|
+
:logger => Logger.new("subscribe.log")
|
101
|
+
}
|
102
|
+
|
103
|
+
Tackle.subscribe(options) do |message|
|
104
|
+
puts message
|
105
|
+
end
|
106
|
+
```
|
107
|
+
|
108
|
+
## Development
|
54
109
|
|
55
110
|
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
56
111
|
run `rake rspec` to run the tests. You can also run `bin/console` for an
|
data/lib/tackle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rt-tackle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rendered Text
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|