garaio_bunny 2.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +231 -0
- data/lib/amq/protocol/extensions.rb +16 -0
- data/lib/bunny/authentication/credentials_encoder.rb +55 -0
- data/lib/bunny/authentication/external_mechanism_encoder.rb +27 -0
- data/lib/bunny/authentication/plain_mechanism_encoder.rb +19 -0
- data/lib/bunny/channel.rb +2055 -0
- data/lib/bunny/channel_id_allocator.rb +82 -0
- data/lib/bunny/concurrent/atomic_fixnum.rb +75 -0
- data/lib/bunny/concurrent/condition.rb +66 -0
- data/lib/bunny/concurrent/continuation_queue.rb +62 -0
- data/lib/bunny/concurrent/linked_continuation_queue.rb +61 -0
- data/lib/bunny/concurrent/synchronized_sorted_set.rb +56 -0
- data/lib/bunny/consumer.rb +128 -0
- data/lib/bunny/consumer_tag_generator.rb +23 -0
- data/lib/bunny/consumer_work_pool.rb +122 -0
- data/lib/bunny/cruby/socket.rb +110 -0
- data/lib/bunny/cruby/ssl_socket.rb +118 -0
- data/lib/bunny/delivery_info.rb +93 -0
- data/lib/bunny/exceptions.rb +269 -0
- data/lib/bunny/exchange.rb +275 -0
- data/lib/bunny/framing.rb +56 -0
- data/lib/bunny/get_response.rb +83 -0
- data/lib/bunny/heartbeat_sender.rb +71 -0
- data/lib/bunny/jruby/socket.rb +57 -0
- data/lib/bunny/jruby/ssl_socket.rb +58 -0
- data/lib/bunny/message_properties.rb +119 -0
- data/lib/bunny/queue.rb +393 -0
- data/lib/bunny/reader_loop.rb +158 -0
- data/lib/bunny/return_info.rb +74 -0
- data/lib/bunny/session.rb +1483 -0
- data/lib/bunny/socket.rb +14 -0
- data/lib/bunny/ssl_socket.rb +14 -0
- data/lib/bunny/test_kit.rb +41 -0
- data/lib/bunny/timeout.rb +7 -0
- data/lib/bunny/transport.rb +526 -0
- data/lib/bunny/version.rb +6 -0
- data/lib/bunny/versioned_delivery_tag.rb +28 -0
- data/lib/bunny.rb +92 -0
- metadata +127 -0
data/lib/bunny.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- encoding: utf-8; mode: ruby -*-
|
2
|
+
|
3
|
+
require "timeout"
|
4
|
+
|
5
|
+
require "bunny/version"
|
6
|
+
require "amq/protocol/client"
|
7
|
+
require "amq/protocol/extensions"
|
8
|
+
|
9
|
+
require "bunny/framing"
|
10
|
+
require "bunny/exceptions"
|
11
|
+
|
12
|
+
require "bunny/socket"
|
13
|
+
|
14
|
+
require "bunny/timeout"
|
15
|
+
|
16
|
+
begin
|
17
|
+
require "openssl"
|
18
|
+
|
19
|
+
require "bunny/ssl_socket"
|
20
|
+
rescue LoadError
|
21
|
+
# no-op
|
22
|
+
end
|
23
|
+
|
24
|
+
require "logger"
|
25
|
+
|
26
|
+
# Core entities: connection, channel, exchange, queue, consumer
|
27
|
+
require "bunny/session"
|
28
|
+
require "bunny/channel"
|
29
|
+
require "bunny/exchange"
|
30
|
+
require "bunny/queue"
|
31
|
+
require "bunny/consumer"
|
32
|
+
|
33
|
+
# Bunny is a RabbitMQ client that focuses on ease of use.
|
34
|
+
# @see http://rubybunny.info
|
35
|
+
module Bunny
|
36
|
+
# AMQP protocol version Bunny implements
|
37
|
+
PROTOCOL_VERSION = AMQ::Protocol::PROTOCOL_VERSION
|
38
|
+
|
39
|
+
#
|
40
|
+
# API
|
41
|
+
#
|
42
|
+
|
43
|
+
# @return [String] Bunny version
|
44
|
+
def self.version
|
45
|
+
VERSION
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [String] AMQP protocol version Bunny implements
|
49
|
+
def self.protocol_version
|
50
|
+
AMQ::Protocol::PROTOCOL_VERSION
|
51
|
+
end
|
52
|
+
|
53
|
+
# Instantiates a new connection. The actual network
|
54
|
+
# connection is started with {Bunny::Session#start}
|
55
|
+
#
|
56
|
+
# @return [Bunny::Session]
|
57
|
+
# @see Bunny::Session#start
|
58
|
+
# @see http://rubybunny.info/articles/getting_started.html
|
59
|
+
# @see http://rubybunny.info/articles/connecting.html
|
60
|
+
# @api public
|
61
|
+
def self.new(connection_string_or_opts = ENV['RABBITMQ_URL'], opts = {})
|
62
|
+
if connection_string_or_opts.respond_to?(:keys) && opts.empty?
|
63
|
+
opts = connection_string_or_opts
|
64
|
+
end
|
65
|
+
|
66
|
+
conn = Session.new(connection_string_or_opts, opts)
|
67
|
+
@default_connection ||= conn
|
68
|
+
|
69
|
+
conn
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
def self.run(connection_string_or_opts = ENV['RABBITMQ_URL'], opts = {}, &block)
|
74
|
+
raise ArgumentError, 'Bunny#run requires a block' unless block
|
75
|
+
|
76
|
+
if connection_string_or_opts.respond_to?(:keys) && opts.empty?
|
77
|
+
opts = connection_string_or_opts
|
78
|
+
end
|
79
|
+
|
80
|
+
client = Session.new(connection_string_or_opts, opts)
|
81
|
+
|
82
|
+
begin
|
83
|
+
client.start
|
84
|
+
block.call(client)
|
85
|
+
ensure
|
86
|
+
client.stop
|
87
|
+
end
|
88
|
+
|
89
|
+
# backwards compatibility
|
90
|
+
:run_ok
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: garaio_bunny
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.19.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Duncan
|
8
|
+
- Eric Lindvall
|
9
|
+
- Jakub Stastny aka botanicus
|
10
|
+
- Michael S. Klishin
|
11
|
+
- Stefan Kaes
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: amq-protocol
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "~>"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '2.3'
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.3.1
|
27
|
+
type: :runtime
|
28
|
+
prerelease: false
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.3'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.3.1
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: sorted_set
|
39
|
+
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.2
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.0.2
|
57
|
+
description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later
|
58
|
+
versions.
|
59
|
+
email:
|
60
|
+
- michael.s.klishin@gmail.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files:
|
64
|
+
- README.md
|
65
|
+
files:
|
66
|
+
- README.md
|
67
|
+
- lib/amq/protocol/extensions.rb
|
68
|
+
- lib/bunny.rb
|
69
|
+
- lib/bunny/authentication/credentials_encoder.rb
|
70
|
+
- lib/bunny/authentication/external_mechanism_encoder.rb
|
71
|
+
- lib/bunny/authentication/plain_mechanism_encoder.rb
|
72
|
+
- lib/bunny/channel.rb
|
73
|
+
- lib/bunny/channel_id_allocator.rb
|
74
|
+
- lib/bunny/concurrent/atomic_fixnum.rb
|
75
|
+
- lib/bunny/concurrent/condition.rb
|
76
|
+
- lib/bunny/concurrent/continuation_queue.rb
|
77
|
+
- lib/bunny/concurrent/linked_continuation_queue.rb
|
78
|
+
- lib/bunny/concurrent/synchronized_sorted_set.rb
|
79
|
+
- lib/bunny/consumer.rb
|
80
|
+
- lib/bunny/consumer_tag_generator.rb
|
81
|
+
- lib/bunny/consumer_work_pool.rb
|
82
|
+
- lib/bunny/cruby/socket.rb
|
83
|
+
- lib/bunny/cruby/ssl_socket.rb
|
84
|
+
- lib/bunny/delivery_info.rb
|
85
|
+
- lib/bunny/exceptions.rb
|
86
|
+
- lib/bunny/exchange.rb
|
87
|
+
- lib/bunny/framing.rb
|
88
|
+
- lib/bunny/get_response.rb
|
89
|
+
- lib/bunny/heartbeat_sender.rb
|
90
|
+
- lib/bunny/jruby/socket.rb
|
91
|
+
- lib/bunny/jruby/ssl_socket.rb
|
92
|
+
- lib/bunny/message_properties.rb
|
93
|
+
- lib/bunny/queue.rb
|
94
|
+
- lib/bunny/reader_loop.rb
|
95
|
+
- lib/bunny/return_info.rb
|
96
|
+
- lib/bunny/session.rb
|
97
|
+
- lib/bunny/socket.rb
|
98
|
+
- lib/bunny/ssl_socket.rb
|
99
|
+
- lib/bunny/test_kit.rb
|
100
|
+
- lib/bunny/timeout.rb
|
101
|
+
- lib/bunny/transport.rb
|
102
|
+
- lib/bunny/version.rb
|
103
|
+
- lib/bunny/versioned_delivery_tag.rb
|
104
|
+
homepage: http://rubybunny.info
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2.2'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubygems_version: 3.3.0
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Popular easy to use Ruby client for RabbitMQ
|
127
|
+
test_files: []
|