rabbitmq 1.0.0.pre.pre → 1.0.0
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 +13 -11
- data/lib/rabbitmq/client.rb +0 -4
- data/lib/rabbitmq/client/connection.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22054636153b22c167c3ad8d50e9f613d23c7af6
|
4
|
+
data.tar.gz: 127d9e3cb05f29f76f4c74dd3be37cd64a5e1f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dead99ee2adae3bb510d5adfe15c66c973cf4a70b9faee176af1e4ef71870e49b0c29406b7c1ce319f993de8414dfae94ec5dc7474c8f0c2409063e82e16ff61
|
7
|
+
data.tar.gz: 4bba178bb2a19e0715927f0756bfeaf833da7bcc3a53417c691110881d7a7399b42779a61f78fa5e3ce8723dd4ed5499374297668fe7ca4dc1e176ba34f26f9e
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# rabbitmq
|
2
2
|
|
3
|
-
[](https://circleci.com/gh/jemc/ruby-rabbitmq/tree/master)
|
4
|
+
[](http://badge.fury.io/rb/rabbitmq)
|
5
|
+
[](https://gitter.im/jemc/ruby-rabbitmq?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
6
|
|
6
|
-
A Ruby RabbitMQ client library based on FFI bindings for librabbitmq.
|
7
|
+
A Ruby [RabbitMQ](https://www.rabbitmq.com/features.html) client library based on [FFI](https://github.com/ffi/ffi/wiki) bindings for [librabbitmq](https://github.com/alanxz/rabbitmq-c).
|
8
|
+
|
9
|
+
##### `$ gem install rabbitmq -v 1.0.0-pre`
|
7
10
|
|
8
11
|
## Design Goals
|
9
12
|
|
@@ -24,19 +27,16 @@ This library does not provide thread-safe client objects. Multithreaded applicat
|
|
24
27
|
|
25
28
|
## Usage
|
26
29
|
|
27
|
-
|
28
|
-
gem install rabbitmq
|
29
|
-
ruby examples/publish_500.rb
|
30
|
-
ruby examples/consume_500.rb
|
31
|
-
```
|
30
|
+
To use this library effectively, it is necessary to understand the possibilities and idioms of RabbitMQ. Users are encouraged to familiarize themselves with the [AMQP protocol reference documentation](http://www.rabbitmq.com/amqp-0-9-1-reference.html).
|
32
31
|
|
32
|
+
##### `$ ruby examples/publish_500.rb`
|
33
33
|
```ruby
|
34
|
-
# examples/publish_500.rb
|
35
34
|
require 'rabbitmq'
|
36
35
|
|
37
36
|
publisher = RabbitMQ::Client.new.start.channel
|
38
37
|
queue = "some_queue"
|
39
38
|
exchange = "" # default exchange
|
39
|
+
publisher.queue_delete(queue)
|
40
40
|
publisher.queue_declare(queue)
|
41
41
|
|
42
42
|
500.times do |i|
|
@@ -44,13 +44,14 @@ publisher.queue_declare(queue)
|
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
|
+
##### `$ ruby examples/consume_500.rb`
|
47
48
|
```ruby
|
48
|
-
# examples/consume_500.rb
|
49
49
|
require 'rabbitmq'
|
50
50
|
|
51
51
|
consumer = RabbitMQ::Client.new.start.channel
|
52
52
|
consumer.basic_qos(prefetch_count: 500)
|
53
|
-
consumer.basic_consume("some_queue")
|
53
|
+
res = consumer.basic_consume("some_queue")
|
54
|
+
tag = res[:properties][:consumer_tag]
|
54
55
|
|
55
56
|
count = 0
|
56
57
|
consumer.on :basic_deliver do |message|
|
@@ -62,6 +63,7 @@ consumer.on :basic_deliver do |message|
|
|
62
63
|
end
|
63
64
|
|
64
65
|
consumer.run_loop!
|
66
|
+
consumer.basic_cancel(tag)
|
65
67
|
```
|
66
68
|
|
67
69
|
## Contributing
|
data/lib/rabbitmq/client.rb
CHANGED
@@ -300,8 +300,6 @@ module RabbitMQ
|
|
300
300
|
|
301
301
|
# Internal implementation of the {#run_loop!} method.
|
302
302
|
private def fetch_events(timeout=protocol_timeout, start=Time.now)
|
303
|
-
@conn.garbage_collect
|
304
|
-
|
305
303
|
while (event = @conn.fetch_next_event(timeout, start))
|
306
304
|
handle_incoming_event(event)
|
307
305
|
store_incoming_event(event)
|
@@ -317,8 +315,6 @@ module RabbitMQ
|
|
317
315
|
return found if found
|
318
316
|
}
|
319
317
|
|
320
|
-
@conn.garbage_collect_channel(channel_id)
|
321
|
-
|
322
318
|
while (event = @conn.fetch_next_event(timeout, start))
|
323
319
|
handle_incoming_event(event)
|
324
320
|
return event if channel_id == event.fetch(:channel) \
|
@@ -137,6 +137,8 @@ module RabbitMQ
|
|
137
137
|
# Fetch the next one or more frames to form the next discrete event,
|
138
138
|
# returning the event as a Hash, or nil if time expired.
|
139
139
|
def fetch_next_event(timeout=0, start=Time.now)
|
140
|
+
garbage_collect
|
141
|
+
|
140
142
|
frame = fetch_next_frame(timeout, start)
|
141
143
|
return unless frame
|
142
144
|
event = frame.as_method_to_h(false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe McIlvain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -222,9 +222,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
224
|
requirements:
|
225
|
-
- - "
|
225
|
+
- - ">="
|
226
226
|
- !ruby/object:Gem::Version
|
227
|
-
version:
|
227
|
+
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
230
|
rubygems_version: 2.2.2
|