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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -17
  3. data/lib/tackle/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c97d2ff7d67880695b2d97d2ecad9b07abafaca6
4
- data.tar.gz: 33cb64ad00cc670d12d675103e2f0a81f1c4ca9b
3
+ metadata.gz: beb7fcc50f104dade384ab9e3090d1edc68c8c6e
4
+ data.tar.gz: 87865b2ef1bea50c964d75cc79302a7aa29b9157
5
5
  SHA512:
6
- metadata.gz: 536a9691867f1a5d25f1cc35785f99c777e4172f826bd65e03d42432647301de49ecdb6d02c7000560e3284859141b5e11c5249337ac164f24bb9b640a878f7f
7
- data.tar.gz: 3b6f70028efc46b0ce4fda79a0305354ebc749a6a580f7bcf117e2d0e09487629841dad15281b41b18c16233ea3026943a86b9d0489d2ecf0dff907d84b55583
6
+ metadata.gz: c6daaaaaab58645d5a22450790a7f44e30304ac68329bec4369d2024f790e5d39a0f6812e26a981ffb3d1bb4c356f14606523d0ecf4ccbd347965beb1ce4fead
7
+ data.tar.gz: 8760c4719ebb9c953fbb8e6aa30a65de5e4332a7a956fb32c1c51906f822952883096769e1982e5154f534d8e80092b4153e415afb00c1561e3e30ed2568bda4
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tackle
2
2
 
3
- [![Build Status](https://semaphoreci.com/api/v1/projects/b39e2ae2-2516-4fd7-9e2c-f5be1a043ff5/732979/badge.svg)](https://semaphoreci.com/renderedtext/tackle)
3
+ [![Build Status](https://semaphoreci.com/api/v1/renderedtext/tackle/branches/master/badge.svg)](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
- ### Subscribe consumer:
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 => "amqp://localhost", # optional
25
- :exchange => "test-exchange", # required
26
- :routing_key => "test-messages", # required
27
- :queue => "test-queue", # required
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
- # Do something with message
62
+ puts message
35
63
  end
36
64
  ```
37
65
 
38
- ### Publish message:
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 => "amqp://localhost", # optional
44
- :exchange => "test-exchange", # required
45
- :routing_key => "test-messages", # required
46
- :logger => Logger.new(STDOUT) # optional
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.publish("Hello, world!", options)
82
+ Tackle.subscribe(options) do |message|
83
+ puts message
84
+ end
50
85
  ```
51
86
 
52
- ## Development
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
@@ -1,3 +1,3 @@
1
1
  module Tackle
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
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.0
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-02 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny