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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb48bad600bce581dcf6ba74ae4cf40d97256fe3
4
- data.tar.gz: 6a552f3a674fe3c14b6368af3745a1b627b4cd28
3
+ metadata.gz: 6ebdae0e3c3cca5415123d244b360243a9567440
4
+ data.tar.gz: d56d1a2a8e244f706db17075ec7b7fd02e44f837
5
5
  SHA512:
6
- metadata.gz: 9fa7f6a1c3e57b08c8cc5f5f0ecc29af7cca1cd16ef24c10746fe7ad1ee8b7ab300a8e221a249fe8d2f2b44884a3ceb2810b34fee2c9f5c39b958d665de437bf
7
- data.tar.gz: 687d311805cb6843a1ac57b5761865ee8da346004404eb9ba5d22f2b4c1dae2f476e80bfa1fc6a33e3fde53a43e378714aa26ef74c5f6a693985bb63af51e8d9
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
- worker = QueueWorker.new('some_queue_name')
22
- worker.push({ name: 'foo' })
23
- worker.handler = proc { |args| puts "Got #{args}" }
24
- worker.subscribe
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 )
@@ -1,3 +1,3 @@
1
1
  class QueueWorker
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
data/queue_worker.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
23
  spec.add_development_dependency 'rspec', '~> 3.1'
24
24
 
25
- spec.add_runtime_dependency 'stomp', '~> 1.3', '>= 1.3.4'
25
+ spec.add_runtime_dependency 'stomp', '~> 1.3'
26
26
  end
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.1
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-18 00:00:00.000000000 Z
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: