queue_worker 1.0.1 → 1.0.2
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 +26 -6
- data/lib/queue_worker/version.rb +1 -1
- data/queue_worker.gemspec +1 -1
- metadata +2 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ebdae0e3c3cca5415123d244b360243a9567440
|
4
|
+
data.tar.gz: d56d1a2a8e244f706db17075ec7b7fd02e44f837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6259ec0585962e44646031ef1c83c3eda99c4fc251ac81075cd5391c2dd3610f62847bfede00b56fbe6d7ec7a8dc462ef0b5c0769927f71cc321e0a99e498ad9
|
7
|
+
data.tar.gz: a67fe1b6db0358fe4d44000f6d5299783b7b60555700b7275ec02209f3864d2bc5d733ec217c608e6aab3675ee2475b083e7a34d1115bd6905e895df656356eb
|
data/README.md
CHANGED
@@ -17,12 +17,32 @@ Or install it yourself as:
|
|
17
17
|
$ gem install queue_worker
|
18
18
|
|
19
19
|
## Usage
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
```ruby
|
21
|
+
worker = QueueWorker.new('some_queue_name')
|
22
|
+
# Publish a message (will be serialized to JSON)
|
23
|
+
worker.push({ name: 'foo' })
|
24
|
+
# Specify the subscribe callback (message is automatically deserialized and ack'd)
|
25
|
+
worker.handler = proc { |args| puts "Got message #{args}" }
|
26
|
+
# Asynchronously subscribe to the queue
|
27
|
+
worker.subscribe
|
28
|
+
```
|
29
|
+
Wait (synchronously) for a message to be received and acknowledged (ack'd) before continuing
|
30
|
+
```ruby
|
31
|
+
worker.join
|
32
|
+
```
|
33
|
+
Remove the listener (thread) and closes the connection
|
34
|
+
```ruby
|
35
|
+
worker.close
|
36
|
+
```
|
37
|
+
Alternatively, a block can be given to `subscribe` and the number of messages to fetch can be specified (default 1).
|
38
|
+
```ruby
|
39
|
+
worker.subscribe(10) do |message|
|
40
|
+
if message.command == 'MESSAGE'
|
41
|
+
puts "Got message #{JSON.parse(message.body, symbolize_names: true)}"
|
42
|
+
end
|
43
|
+
worker.ack(message)
|
44
|
+
end
|
45
|
+
```
|
26
46
|
## Contributing
|
27
47
|
|
28
48
|
1. Fork it ( https://github.com/ridiculous/queue_worker/fork )
|
data/lib/queue_worker/version.rb
CHANGED
data/queue_worker.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,9 +59,6 @@ dependencies:
|
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 1.3.4
|
65
62
|
type: :runtime
|
66
63
|
prerelease: false
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,9 +66,6 @@ dependencies:
|
|
69
66
|
- - "~>"
|
70
67
|
- !ruby/object:Gem::Version
|
71
68
|
version: '1.3'
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.3.4
|
75
69
|
description: A light STOMP wrapper to ease interaction with a queueing system (e.g.
|
76
70
|
ActiveMQ)
|
77
71
|
email:
|