amqp 1.1.0.pre2 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +6 -0
- data/amqp.gemspec +1 -1
- data/examples/extensions/rabbitmq/connection_blocking.rb +48 -0
- data/lib/amqp/exchange.rb +4 -11
- data/lib/amqp/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7625109caea37f9496974e15387dc90e920baa99
|
4
|
+
data.tar.gz: 207ec33c2beaca7afe60f712825b84301fb63d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d85451a233fb14c1135629099ec8a1806ebac0ad46dd0c392339862a3936e69b32b50eec4c05f511e77f5bc7fe459d81a62a314e527f992544fb2d99a9d892
|
7
|
+
data.tar.gz: 35eed4d61c06807d19f7a9a08ff26dc34052085d38c5f5402ebd45abe9558a2b0ec9d799f24789e237d8ad11ed0e3657ed5c47859f448219bfa5626be268659e
|
data/ChangeLog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Changes Between 1.0.0 and 1.1.0
|
2
2
|
|
3
|
+
### amq-protocol Update
|
4
|
+
|
5
|
+
Minimum `amq-protocol` version is now `1.8.0` which includes
|
6
|
+
a bug fix for messages exactly 128 Kb in size.
|
7
|
+
|
8
|
+
|
3
9
|
### AMQ::Client is Removed
|
4
10
|
|
5
11
|
`amq-client` has been incorporated into amqp gem. `AMQ::Client` and related
|
data/amqp.gemspec
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require "bundler"
|
5
|
+
Bundler.setup
|
6
|
+
|
7
|
+
$:.unshift(File.expand_path("../../../../lib", __FILE__))
|
8
|
+
require 'amqp'
|
9
|
+
require "amqp/extensions/rabbitmq"
|
10
|
+
|
11
|
+
puts "=> Demonstrating connection.blocked"
|
12
|
+
puts
|
13
|
+
|
14
|
+
# This example requires high memory watermark to be set
|
15
|
+
# really low to demonstrate blocking.
|
16
|
+
#
|
17
|
+
# rabbitmqctl set_vm_memory_high_watermark 0.00000001
|
18
|
+
#
|
19
|
+
# should do it.
|
20
|
+
|
21
|
+
EventMachine.run do
|
22
|
+
connection = AMQP.connect(:host => '127.0.0.1')
|
23
|
+
|
24
|
+
connection.on_blocked do |conn, conn_blocked|
|
25
|
+
puts "Connection blocked, reason: #{conn_blocked.reason}"
|
26
|
+
end
|
27
|
+
|
28
|
+
connection.on_unblocked do |conn, _|
|
29
|
+
puts "Connection unblocked"
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "Connecting to RabbitMQ. Running #{AMQP::VERSION} version of the gem..."
|
33
|
+
|
34
|
+
AMQP::Channel.new(connection) do |ch|
|
35
|
+
x = ch.default_exchange
|
36
|
+
|
37
|
+
puts "Publishing..."
|
38
|
+
x.publish("z" * 1024 * 1024 * 24)
|
39
|
+
end
|
40
|
+
|
41
|
+
show_stopper = Proc.new {
|
42
|
+
connection.close { EventMachine.stop }
|
43
|
+
}
|
44
|
+
|
45
|
+
EM.add_timer(120, show_stopper)
|
46
|
+
Signal.trap('INT', show_stopper)
|
47
|
+
Signal.trap('TERM', show_stopper)
|
48
|
+
end
|
data/lib/amqp/exchange.rb
CHANGED
@@ -317,8 +317,7 @@ module AMQP
|
|
317
317
|
@status = :unknown
|
318
318
|
@default_publish_options = (opts.delete(:default_publish_options) || {
|
319
319
|
:routing_key => @default_routing_key,
|
320
|
-
:mandatory => false
|
321
|
-
:immediate => false
|
320
|
+
:mandatory => false
|
322
321
|
}).freeze
|
323
322
|
|
324
323
|
@default_headers = (opts.delete(:default_headers) || {
|
@@ -503,12 +502,6 @@ module AMQP
|
|
503
502
|
# unroutable message back to the client with basic.return AMQPmethod.
|
504
503
|
# If message is not mandatory, the server silently drops the message.
|
505
504
|
#
|
506
|
-
# @option options [Boolean] :immediate (false) This flag tells the server how to react if the message cannot be
|
507
|
-
# routed to a queue consumer immediately. If this flag is set, the
|
508
|
-
# server will return an undeliverable message with a Return method.
|
509
|
-
# If this flag is zero, the server will queue the message, but with
|
510
|
-
# no guarantee that it will ever be consumed.
|
511
|
-
#
|
512
505
|
# @option options [Boolean] :persistent (false) When true, this message will be persisted to disk and remain in the queue until
|
513
506
|
# it is consumed. When false, the message is only kept in a transient store
|
514
507
|
# and will lost in case of server restart.
|
@@ -539,7 +532,7 @@ module AMQP
|
|
539
532
|
@channel.once_open do
|
540
533
|
properties = @default_headers.merge(options)
|
541
534
|
properties[:delivery_mode] = properties.delete(:persistent) ? 2 : 1
|
542
|
-
basic_publish(payload.to_s, opts[:key] || opts[:routing_key] || @default_routing_key, properties, opts[:mandatory]
|
535
|
+
basic_publish(payload.to_s, opts[:key] || opts[:routing_key] || @default_routing_key, properties, opts[:mandatory])
|
543
536
|
|
544
537
|
# don't pass block to AMQP::Exchange#publish because it will be executed
|
545
538
|
# immediately and we want to do it later. See ruby-amqp/amqp/#67 MK.
|
@@ -664,9 +657,9 @@ module AMQP
|
|
664
657
|
# @group Publishing Messages
|
665
658
|
|
666
659
|
# @api public
|
667
|
-
def basic_publish(payload, routing_key = AMQ::Protocol::EMPTY_STRING, user_headers = {}, mandatory = false
|
660
|
+
def basic_publish(payload, routing_key = AMQ::Protocol::EMPTY_STRING, user_headers = {}, mandatory = false)
|
668
661
|
headers = { :priority => 0, :delivery_mode => 2, :content_type => "application/octet-stream" }.merge(user_headers)
|
669
|
-
@connection.send_frameset(AMQ::Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory,
|
662
|
+
@connection.send_frameset(AMQ::Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, false, @connection.frame_max), @channel)
|
670
663
|
|
671
664
|
# publisher confirms support. MK.
|
672
665
|
@channel.exec_callback(:after_publish)
|
data/lib/amqp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: eventmachine
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 1.
|
35
|
+
version: 1.8.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 1.
|
42
|
+
version: 1.8.0
|
43
43
|
description: Widely used, feature-rich asynchronous RabbitMQ client with batteries
|
44
44
|
included.
|
45
45
|
email:
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- examples/error_handling/tcp_connection_failure_with_a_callback.rb
|
141
141
|
- examples/exchanges/autodeletion_of_exchanges.rb
|
142
142
|
- examples/exchanges/declare_an_exchange_without_assignment.rb
|
143
|
+
- examples/extensions/rabbitmq/connection_blocking.rb
|
143
144
|
- examples/extensions/rabbitmq/per_queue_message_ttl.rb
|
144
145
|
- examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb
|
145
146
|
- examples/extensions/rabbitmq/using_alternate_exchanges.rb
|