rabbitmq 0.2.3 → 0.2.4
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 +3 -0
- data/ext/rabbitmq/Rakefile +14 -9
- data/lib/rabbitmq/connection/channel_manager.rb +61 -0
- data/lib/rabbitmq/connection/event_manager.rb +55 -0
- data/lib/rabbitmq/connection/transport.rb +157 -0
- data/lib/rabbitmq/ffi.rb +4 -356
- data/lib/rabbitmq/ffi/ext.rb +12 -299
- data/lib/rabbitmq/ffi/ext/basic_properties.rb +57 -0
- data/lib/rabbitmq/ffi/ext/bytes.rb +29 -0
- data/lib/rabbitmq/ffi/ext/connection_info.rb +12 -0
- data/lib/rabbitmq/ffi/ext/field_value.rb +49 -0
- data/lib/rabbitmq/ffi/ext/frame.rb +43 -0
- data/lib/rabbitmq/ffi/ext/frame_payload_properties.rb +12 -0
- data/lib/rabbitmq/ffi/ext/method.rb +49 -0
- data/lib/rabbitmq/ffi/ext/table.rb +51 -0
- data/lib/rabbitmq/ffi/ext/timeval.rb +18 -0
- data/lib/rabbitmq/ffi/gen.rb +65 -0
- data/lib/rabbitmq/ffi/gen/access_request.rb +49 -0
- data/lib/rabbitmq/ffi/gen/access_request_ok.rb +29 -0
- data/lib/rabbitmq/ffi/gen/basic_ack.rb +36 -0
- data/lib/rabbitmq/ffi/gen/basic_cancel.rb +37 -0
- data/lib/rabbitmq/ffi/gen/basic_cancel_ok.rb +30 -0
- data/lib/rabbitmq/ffi/gen/basic_consume.rb +57 -0
- data/lib/rabbitmq/ffi/gen/basic_consume_ok.rb +30 -0
- data/lib/rabbitmq/ffi/gen/basic_deliver.rb +48 -0
- data/lib/rabbitmq/ffi/gen/basic_get.rb +40 -0
- data/lib/rabbitmq/ffi/gen/basic_get_empty.rb +30 -0
- data/lib/rabbitmq/ffi/gen/basic_get_ok.rb +47 -0
- data/lib/rabbitmq/ffi/gen/basic_nack.rb +39 -0
- data/lib/rabbitmq/ffi/gen/basic_publish.rb +47 -0
- data/lib/rabbitmq/ffi/gen/basic_qos.rb +39 -0
- data/lib/rabbitmq/ffi/gen/basic_qos_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/basic_recover.rb +29 -0
- data/lib/rabbitmq/ffi/gen/basic_recover_async.rb +29 -0
- data/lib/rabbitmq/ffi/gen/basic_recover_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/basic_reject.rb +36 -0
- data/lib/rabbitmq/ffi/gen/basic_return.rb +45 -0
- data/lib/rabbitmq/ffi/gen/channel_close.rb +45 -0
- data/lib/rabbitmq/ffi/gen/channel_close_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/channel_flow.rb +29 -0
- data/lib/rabbitmq/ffi/gen/channel_flow_ok.rb +29 -0
- data/lib/rabbitmq/ffi/gen/channel_open.rb +30 -0
- data/lib/rabbitmq/ffi/gen/channel_open_ok.rb +30 -0
- data/lib/rabbitmq/ffi/gen/confirm_select.rb +29 -0
- data/lib/rabbitmq/ffi/gen/confirm_select_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/connection_blocked.rb +30 -0
- data/lib/rabbitmq/ffi/gen/connection_close.rb +45 -0
- data/lib/rabbitmq/ffi/gen/connection_close_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/connection_open.rb +41 -0
- data/lib/rabbitmq/ffi/gen/connection_open_ok.rb +30 -0
- data/lib/rabbitmq/ffi/gen/connection_secure.rb +30 -0
- data/lib/rabbitmq/ffi/gen/connection_secure_ok.rb +30 -0
- data/lib/rabbitmq/ffi/gen/connection_start.rb +48 -0
- data/lib/rabbitmq/ffi/gen/connection_start_ok.rb +46 -0
- data/lib/rabbitmq/ffi/gen/connection_tune.rb +39 -0
- data/lib/rabbitmq/ffi/gen/connection_tune_ok.rb +39 -0
- data/lib/rabbitmq/ffi/gen/connection_unblocked.rb +28 -0
- data/lib/rabbitmq/ffi/gen/exchange_bind.rb +52 -0
- data/lib/rabbitmq/ffi/gen/exchange_bind_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/exchange_declare.rb +60 -0
- data/lib/rabbitmq/ffi/gen/exchange_declare_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/exchange_delete.rb +43 -0
- data/lib/rabbitmq/ffi/gen/exchange_delete_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/exchange_unbind.rb +52 -0
- data/lib/rabbitmq/ffi/gen/exchange_unbind_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/queue_bind.rb +52 -0
- data/lib/rabbitmq/ffi/gen/queue_bind_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/queue_declare.rb +56 -0
- data/lib/rabbitmq/ffi/gen/queue_declare_ok.rb +40 -0
- data/lib/rabbitmq/ffi/gen/queue_delete.rb +46 -0
- data/lib/rabbitmq/ffi/gen/queue_delete_ok.rb +29 -0
- data/lib/rabbitmq/ffi/gen/queue_purge.rb +40 -0
- data/lib/rabbitmq/ffi/gen/queue_purge_ok.rb +29 -0
- data/lib/rabbitmq/ffi/gen/queue_unbind.rb +49 -0
- data/lib/rabbitmq/ffi/gen/queue_unbind_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_commit.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_commit_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_rollback.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_rollback_ok.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_select.rb +28 -0
- data/lib/rabbitmq/ffi/gen/tx_select_ok.rb +28 -0
- metadata +79 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a316aadf277e65f4cdc221c69968f5384857db0
|
4
|
+
data.tar.gz: d60a1d8a3f037ecf5c34680ee4ae53dc8573f0d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4c2d7de59bc0f09122c77c3af96c6ff2bb04c16af0de3aa5b495d44bff738445205405d3a5a4b87e51b50cf7b51273c36b077165988a4d951974ae3bd6c5f1e
|
7
|
+
data.tar.gz: ea4f0cfe51575d0d7a2caa1411bf51bc650466197f41caab43cc858db5cba7d3e865b0ae7088e5cc6745e0cd2d1114ae61da66d6baddbbcd395dd527e446b0b6
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
1
|
# rabbitmq
|
2
2
|
|
3
|
+
[](https://travis-ci.org/jemc/ruby-rabbitmq)
|
4
|
+
[](http://badge.fury.io/rb/rabbitmq)
|
5
|
+
|
3
6
|
A Ruby RabbitMQ client library based on FFI bindings for librabbitmq.
|
data/ext/rabbitmq/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'rake/clean'
|
3
|
+
require 'ffi'
|
3
4
|
|
4
5
|
FILES = {}
|
5
6
|
|
@@ -19,24 +20,28 @@ def self.file_task(filename, opts, &block)
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
def cmd(string)
|
24
|
+
fail "Command failed: #{string}" unless system(string)
|
25
|
+
end
|
26
|
+
|
22
27
|
file_task 'rabbitmq-c.tar.gz', :download_tarball do
|
23
28
|
version = "0.6.0"
|
24
29
|
release = "https://github.com/alanxz/rabbitmq-c/releases/download/v#{version}/rabbitmq-c-#{version}.tar.gz"
|
25
|
-
|
26
|
-
|
30
|
+
cmd "wget #{release}"
|
31
|
+
cmd "mv #{File.basename(release)} #{FILES[:download_tarball]}"
|
27
32
|
end
|
28
33
|
|
29
34
|
file_task 'rabbitmq-c', :download => :download_tarball do
|
30
|
-
|
31
|
-
|
35
|
+
cmd "tar -xf #{FILES[:download_tarball]}"
|
36
|
+
cmd "mv rabbitmq-c-* #{FILES[:download]}"
|
32
37
|
end
|
33
38
|
|
34
39
|
file_task 'config.status', :configure => :download do
|
35
|
-
|
36
|
-
|
40
|
+
cmd "bash -c 'cd #{FILES[:download]} && env CFLAGS=-g ./configure'"
|
41
|
+
cmd "cp #{FILES[:download]}/#{FILES[:configure]} ./"
|
37
42
|
end
|
38
43
|
|
39
|
-
file_task
|
40
|
-
|
41
|
-
|
44
|
+
file_task "librabbitmq.#{::FFI::Platform::LIBSUFFIX}", :build => :configure do
|
45
|
+
cmd "bash -c 'cd #{FILES[:download]} && make'"
|
46
|
+
cmd "cp #{FILES[:download]}/librabbitmq/.libs/#{FILES[:build]} ."
|
42
47
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
module RabbitMQ
|
3
|
+
class Connection
|
4
|
+
|
5
|
+
class ChannelManager
|
6
|
+
def initialize(connection)
|
7
|
+
@connection = connection
|
8
|
+
@open_channels = {}
|
9
|
+
@released_channels = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def allocate_channel(id=nil)
|
13
|
+
if id
|
14
|
+
raise ArgumentError, "channel #{id} is already in use" if @open_channels[id]
|
15
|
+
elsif @released_channels.empty?
|
16
|
+
id = (@open_channels.keys.sort.last || 0) + 1
|
17
|
+
else
|
18
|
+
id = @released_channels.keys.first
|
19
|
+
end
|
20
|
+
raise ArgumentError, "channel #{id} is too high" if id > @connection.max_channels
|
21
|
+
|
22
|
+
already_open = @released_channels.delete(id)
|
23
|
+
request_channel_open(id) unless already_open
|
24
|
+
|
25
|
+
@open_channels[id] = true
|
26
|
+
@event_handlers[id] ||= {}
|
27
|
+
|
28
|
+
id
|
29
|
+
end
|
30
|
+
|
31
|
+
def release_channel(id)
|
32
|
+
@open_channels.delete(id)
|
33
|
+
@released_channels[id] = true
|
34
|
+
end
|
35
|
+
|
36
|
+
def release_all_channels
|
37
|
+
@open_channels.clear
|
38
|
+
@released_channels.clear
|
39
|
+
end
|
40
|
+
|
41
|
+
def request_channel_open(id)
|
42
|
+
Util.error_check :"opening a new channel",
|
43
|
+
@connection.send_request_internal(id, :channel_open)
|
44
|
+
|
45
|
+
@connection.fetch_response(id, :channel_open_ok)
|
46
|
+
end
|
47
|
+
|
48
|
+
def request_channel_reopen(id)
|
49
|
+
Util.error_check :"acknowledging server-initated channel closure",
|
50
|
+
@connection.send_request_internal(id, :channel_close_ok)
|
51
|
+
|
52
|
+
Util.error_check :"reopening channel after server-initated closure",
|
53
|
+
@connection.send_request_internal(id, :channel_open)
|
54
|
+
|
55
|
+
@connection.fetch_response(id, :channel_open_ok)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
module RabbitMQ
|
3
|
+
class Connection
|
4
|
+
|
5
|
+
class EventManager
|
6
|
+
def initialize(connection)
|
7
|
+
@connection = connection
|
8
|
+
@event_handlers = Hash.new { |h,k| h[k] = {} }
|
9
|
+
@incoming_events = Hash.new { |h,k| h[k] = {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def register_handler(id, method, handler)
|
13
|
+
@event_handlers[id][method] = handler
|
14
|
+
end
|
15
|
+
|
16
|
+
def clear_event_handlers(id)
|
17
|
+
@event_handlers.delete(id)
|
18
|
+
end
|
19
|
+
|
20
|
+
def clear_all_event_handlers
|
21
|
+
@event_handlers.clear
|
22
|
+
end
|
23
|
+
|
24
|
+
# Execute the handler for this type of event, if any
|
25
|
+
def handle_incoming_event(event)
|
26
|
+
if (handlers = @event_handlers[event.fetch(:channel)])
|
27
|
+
if (handler = (handlers[event.fetch(:method)]))
|
28
|
+
handler.call(event)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Store the event in short-term storage for retrieval by fetch_response.
|
34
|
+
# If another event is received with the same method name, it will
|
35
|
+
# overwrite this one - fetch_response gets the latest or next by method.
|
36
|
+
def store_incoming_event(event)
|
37
|
+
method = event.fetch(:method)
|
38
|
+
|
39
|
+
case method
|
40
|
+
when :channel_close
|
41
|
+
raise_if_server_error!(event)
|
42
|
+
when :connection_close
|
43
|
+
raise_if_server_error!(event)
|
44
|
+
else
|
45
|
+
@incoming_events[event.fetch(:channel)][method] = event
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def fetch_stored_event(channel_id, method)
|
50
|
+
@incoming_events[channel_id].delete(method)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
module RabbitMQ
|
5
|
+
class Connection
|
6
|
+
|
7
|
+
class DestroyedError < RuntimeError; end
|
8
|
+
|
9
|
+
class Transport
|
10
|
+
|
11
|
+
attr_reader :ptr
|
12
|
+
|
13
|
+
def initialize(connnection)
|
14
|
+
@ptr = FFI.amqp_new_connection
|
15
|
+
@frame = FFI::Frame.new
|
16
|
+
@connection = connnection
|
17
|
+
|
18
|
+
create_socket!
|
19
|
+
|
20
|
+
@finalizer = self.class.create_finalizer_for(@ptr)
|
21
|
+
ObjectSpace.define_finalizer(self, @finalizer)
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
if @finalizer
|
26
|
+
@finalizer.call
|
27
|
+
ObjectSpace.undefine_finalizer(self)
|
28
|
+
end
|
29
|
+
@ptr = @socket = @finalizer = nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# @private
|
33
|
+
def self.create_finalizer_for(ptr)
|
34
|
+
Proc.new do
|
35
|
+
FFI.amqp_connection_close(ptr, 200)
|
36
|
+
FFI.amqp_destroy_connection(ptr)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def ptr
|
41
|
+
raise DestroyedError unless @ptr
|
42
|
+
@ptr
|
43
|
+
end
|
44
|
+
|
45
|
+
def close
|
46
|
+
raise DestroyedError unless @ptr
|
47
|
+
FFI.amqp_connection_close(@ptr, 200)
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_socket!
|
51
|
+
raise DestroyedError unless @ptr
|
52
|
+
|
53
|
+
@socket = FFI.amqp_tcp_socket_new(@ptr)
|
54
|
+
Util.null_check :"creating a socket", @socket
|
55
|
+
end
|
56
|
+
|
57
|
+
def connect_socket!
|
58
|
+
raise DestroyedError unless @ptr
|
59
|
+
raise NotImplementedError if @connection.ssl?
|
60
|
+
|
61
|
+
create_socket!
|
62
|
+
Util.error_check :"opening a socket",
|
63
|
+
FFI.amqp_socket_open(@socket, @connection.host, @connection.port)
|
64
|
+
|
65
|
+
@ruby_socket = Socket.for_fd(FFI.amqp_get_sockfd(@ptr))
|
66
|
+
@ruby_socket.autoclose = false
|
67
|
+
end
|
68
|
+
|
69
|
+
def login!
|
70
|
+
raise DestroyedError unless @ptr
|
71
|
+
|
72
|
+
res = FFI.amqp_login(@ptr, @connection.vhost,
|
73
|
+
@connection.max_channels, @connection.max_frame_size,
|
74
|
+
@connection.heartbeat_interval, :plain,
|
75
|
+
:string, @connection.user, :string, @connection.password)
|
76
|
+
|
77
|
+
case res[:reply_type]
|
78
|
+
when :library_exception; Util.error_check :"logging in", res[:library_error]
|
79
|
+
when :server_exception; raise NotImplementedError
|
80
|
+
end
|
81
|
+
|
82
|
+
@server_properties = FFI::Table.new(FFI.amqp_get_server_properties(@ptr)).to_h
|
83
|
+
end
|
84
|
+
|
85
|
+
# Block until there is readable data on the internal ruby socket,
|
86
|
+
# returning true if there is readable data, or false if time expired.
|
87
|
+
def select(timeout=0, start=Time.now)
|
88
|
+
if timeout
|
89
|
+
timeout = timeout - (start-Time.now)
|
90
|
+
timeout = 0 if timeout < 0
|
91
|
+
end
|
92
|
+
|
93
|
+
IO.select([@ruby_socket], [], [], timeout) ? true : false
|
94
|
+
end
|
95
|
+
|
96
|
+
# Return the next available frame, or nil if time expired.
|
97
|
+
def fetch_next_frame(timeout=0, start=Time.now)
|
98
|
+
frame = @frame
|
99
|
+
|
100
|
+
# Try fetching the next frame without a blocking call.
|
101
|
+
status = FFI.amqp_simple_wait_frame_noblock(@ptr, frame, FFI::Timeval.zero)
|
102
|
+
case status
|
103
|
+
when :ok; return frame
|
104
|
+
when :timeout; # do nothing and proceed to waiting on select below
|
105
|
+
else Util.error_check :"fetching the next frame", status
|
106
|
+
end
|
107
|
+
|
108
|
+
# Otherwise, wait for the socket to be readable and try fetching again.
|
109
|
+
return nil unless select(timeout, start)
|
110
|
+
Util.error_check :"fetching the next frame",
|
111
|
+
FFI.amqp_simple_wait_frame(@ptr, frame)
|
112
|
+
|
113
|
+
frame
|
114
|
+
end
|
115
|
+
|
116
|
+
# Fetch the next one or more frames to form the next discrete event,
|
117
|
+
# returning the event as a Hash, or nil if time expired.
|
118
|
+
def fetch_next_event(timeout=0, start=Time.now)
|
119
|
+
frame = fetch_next_frame(timeout, start)
|
120
|
+
return unless frame
|
121
|
+
event = frame.as_method_to_h(false)
|
122
|
+
return event unless FFI::Method.has_content?(event.fetch(:method))
|
123
|
+
|
124
|
+
frame = fetch_next_frame(timeout, start)
|
125
|
+
return unless frame
|
126
|
+
event.merge!(frame.as_header_to_h)
|
127
|
+
|
128
|
+
body = ""
|
129
|
+
while body.size < event.fetch(:body_size)
|
130
|
+
frame = fetch_next_frame(timeout, start)
|
131
|
+
return unless frame
|
132
|
+
body.concat frame.as_body_to_s
|
133
|
+
end
|
134
|
+
|
135
|
+
event[:body] = body
|
136
|
+
event
|
137
|
+
end
|
138
|
+
|
139
|
+
def send_method(channel_id, method, properties={})
|
140
|
+
req = FFI::Method.lookup_class(method).new.apply(properties)
|
141
|
+
status = FFI.amqp_send_method(ptr, channel_id, method, req.pointer)
|
142
|
+
|
143
|
+
req.free!
|
144
|
+
status
|
145
|
+
end
|
146
|
+
|
147
|
+
def garbage_collect
|
148
|
+
FFI.amqp_maybe_release_buffers(ptr)
|
149
|
+
end
|
150
|
+
|
151
|
+
def garbage_collect_channel(channel_id)
|
152
|
+
FFI.amqp_maybe_release_buffers_on_channel(ptr, channel_id)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
data/lib/rabbitmq/ffi.rb
CHANGED
@@ -6,9 +6,11 @@ module RabbitMQ
|
|
6
6
|
module FFI
|
7
7
|
extend ::FFI::Library
|
8
8
|
|
9
|
+
libfile = "librabbitmq.#{::FFI::Platform::LIBSUFFIX}"
|
10
|
+
|
9
11
|
ffi_lib ::FFI::Library::LIBC
|
10
12
|
ffi_lib \
|
11
|
-
File.expand_path("../../ext/rabbitmq
|
13
|
+
File.expand_path("../../ext/rabbitmq/#{libfile}", File.dirname(__FILE__))
|
12
14
|
|
13
15
|
begin # TODO: remove begin/end block
|
14
16
|
opts = {
|
@@ -289,361 +291,7 @@ module RabbitMQ
|
|
289
291
|
attach_function :amqp_encode_method, [MethodNumber, :pointer, Bytes.val], Status, **opts
|
290
292
|
attach_function :amqp_encode_properties, [:uint16, :pointer, Bytes.val], Status, **opts
|
291
293
|
|
292
|
-
|
293
|
-
layout :version_major, :uint8,
|
294
|
-
:version_minor, :uint8,
|
295
|
-
:server_properties, Table,
|
296
|
-
:mechanisms, Bytes,
|
297
|
-
:locales, Bytes
|
298
|
-
end
|
299
|
-
|
300
|
-
class ConnectionStartOk < ::FFI::Struct
|
301
|
-
layout :client_properties, Table,
|
302
|
-
:mechanism, Bytes,
|
303
|
-
:response, Bytes,
|
304
|
-
:locale, Bytes
|
305
|
-
end
|
306
|
-
|
307
|
-
class ConnectionSecure < ::FFI::Struct
|
308
|
-
layout :challenge, Bytes
|
309
|
-
end
|
310
|
-
|
311
|
-
class ConnectionSecureOk < ::FFI::Struct
|
312
|
-
layout :response, Bytes
|
313
|
-
end
|
314
|
-
|
315
|
-
class ConnectionTune < ::FFI::Struct
|
316
|
-
layout :channel_max, :uint16,
|
317
|
-
:frame_max, :uint32,
|
318
|
-
:heartbeat, :uint16
|
319
|
-
end
|
320
|
-
|
321
|
-
class ConnectionTuneOk < ::FFI::Struct
|
322
|
-
layout :channel_max, :uint16,
|
323
|
-
:frame_max, :uint32,
|
324
|
-
:heartbeat, :uint16
|
325
|
-
end
|
326
|
-
|
327
|
-
class ConnectionOpen < ::FFI::Struct
|
328
|
-
layout :virtual_host, Bytes,
|
329
|
-
:capabilities, Bytes,
|
330
|
-
:insist, Boolean
|
331
|
-
end
|
332
|
-
|
333
|
-
class ConnectionOpenOk < ::FFI::Struct
|
334
|
-
layout :known_hosts, Bytes
|
335
|
-
end
|
336
|
-
|
337
|
-
class ConnectionClose < ::FFI::Struct
|
338
|
-
layout :reply_code, :uint16,
|
339
|
-
:reply_text, Bytes,
|
340
|
-
:class_id, :uint16,
|
341
|
-
:method_id, :uint16
|
342
|
-
end
|
343
|
-
|
344
|
-
class ConnectionCloseOk < ::FFI::Struct
|
345
|
-
layout :dummy, :char
|
346
|
-
end
|
347
|
-
|
348
|
-
class ConnectionBlocked < ::FFI::Struct
|
349
|
-
layout :reason, Bytes
|
350
|
-
end
|
351
|
-
|
352
|
-
class ConnectionUnblocked < ::FFI::Struct
|
353
|
-
layout :dummy, :char
|
354
|
-
end
|
355
|
-
|
356
|
-
class ChannelOpen < ::FFI::Struct
|
357
|
-
layout :out_of_band, Bytes
|
358
|
-
end
|
359
|
-
|
360
|
-
class ChannelOpenOk < ::FFI::Struct
|
361
|
-
layout :channel_id, Bytes
|
362
|
-
end
|
363
|
-
|
364
|
-
class ChannelFlow < ::FFI::Struct
|
365
|
-
layout :active, Boolean
|
366
|
-
end
|
367
|
-
|
368
|
-
class ChannelFlowOk < ::FFI::Struct
|
369
|
-
layout :active, Boolean
|
370
|
-
end
|
371
|
-
|
372
|
-
class ChannelClose < ::FFI::Struct
|
373
|
-
layout :reply_code, :uint16,
|
374
|
-
:reply_text, Bytes,
|
375
|
-
:class_id, :uint16,
|
376
|
-
:method_id, :uint16
|
377
|
-
end
|
378
|
-
|
379
|
-
class ChannelCloseOk < ::FFI::Struct
|
380
|
-
layout :dummy, :char
|
381
|
-
end
|
382
|
-
|
383
|
-
class AccessRequest < ::FFI::Struct
|
384
|
-
layout :realm, Bytes,
|
385
|
-
:exclusive, Boolean,
|
386
|
-
:passive, Boolean,
|
387
|
-
:active, Boolean,
|
388
|
-
:write, Boolean,
|
389
|
-
:read, Boolean
|
390
|
-
end
|
391
|
-
|
392
|
-
class AccessRequestOk < ::FFI::Struct
|
393
|
-
layout :ticket, :uint16
|
394
|
-
end
|
395
|
-
|
396
|
-
class ExchangeDeclare < ::FFI::Struct
|
397
|
-
layout :ticket, :uint16,
|
398
|
-
:exchange, Bytes,
|
399
|
-
:type, Bytes,
|
400
|
-
:passive, Boolean,
|
401
|
-
:durable, Boolean,
|
402
|
-
:auto_delete, Boolean,
|
403
|
-
:internal, Boolean,
|
404
|
-
:nowait, Boolean,
|
405
|
-
:arguments, Table
|
406
|
-
end
|
407
|
-
|
408
|
-
class ExchangeDeclareOk < ::FFI::Struct
|
409
|
-
layout :dummy, :char
|
410
|
-
end
|
411
|
-
|
412
|
-
class ExchangeDelete < ::FFI::Struct
|
413
|
-
layout :ticket, :uint16,
|
414
|
-
:exchange, Bytes,
|
415
|
-
:if_unused, Boolean,
|
416
|
-
:nowait, Boolean
|
417
|
-
end
|
418
|
-
|
419
|
-
class ExchangeDeleteOk < ::FFI::Struct
|
420
|
-
layout :dummy, :char
|
421
|
-
end
|
422
|
-
|
423
|
-
class ExchangeBind < ::FFI::Struct
|
424
|
-
layout :ticket, :uint16,
|
425
|
-
:destination, Bytes,
|
426
|
-
:source, Bytes,
|
427
|
-
:routing_key, Bytes,
|
428
|
-
:nowait, Boolean,
|
429
|
-
:arguments, Table
|
430
|
-
end
|
431
|
-
|
432
|
-
class ExchangeBindOk < ::FFI::Struct
|
433
|
-
layout :dummy, :char
|
434
|
-
end
|
435
|
-
|
436
|
-
class ExchangeUnbind < ::FFI::Struct
|
437
|
-
layout :ticket, :uint16,
|
438
|
-
:destination, Bytes,
|
439
|
-
:source, Bytes,
|
440
|
-
:routing_key, Bytes,
|
441
|
-
:nowait, Boolean,
|
442
|
-
:arguments, Table
|
443
|
-
end
|
444
|
-
|
445
|
-
class ExchangeUnbindOk < ::FFI::Struct
|
446
|
-
layout :dummy, :char
|
447
|
-
end
|
448
|
-
|
449
|
-
class QueueDeclare < ::FFI::Struct
|
450
|
-
layout :ticket, :uint16,
|
451
|
-
:queue, Bytes,
|
452
|
-
:passive, Boolean,
|
453
|
-
:durable, Boolean,
|
454
|
-
:exclusive, Boolean,
|
455
|
-
:auto_delete, Boolean,
|
456
|
-
:nowait, Boolean,
|
457
|
-
:arguments, Table
|
458
|
-
end
|
459
|
-
|
460
|
-
class QueueDeclareOk < ::FFI::Struct
|
461
|
-
layout :queue, Bytes,
|
462
|
-
:message_count, :uint32,
|
463
|
-
:consumer_count, :uint32
|
464
|
-
end
|
465
|
-
|
466
|
-
class QueueBind < ::FFI::Struct
|
467
|
-
layout :ticket, :uint16,
|
468
|
-
:queue, Bytes,
|
469
|
-
:exchange, Bytes,
|
470
|
-
:routing_key, Bytes,
|
471
|
-
:nowait, Boolean,
|
472
|
-
:arguments, Table
|
473
|
-
end
|
474
|
-
|
475
|
-
class QueueBindOk < ::FFI::Struct
|
476
|
-
layout :dummy, :char
|
477
|
-
end
|
478
|
-
|
479
|
-
class QueuePurge < ::FFI::Struct
|
480
|
-
layout :ticket, :uint16,
|
481
|
-
:queue, Bytes,
|
482
|
-
:nowait, Boolean
|
483
|
-
end
|
484
|
-
|
485
|
-
class QueuePurgeOk < ::FFI::Struct
|
486
|
-
layout :message_count, :uint32
|
487
|
-
end
|
488
|
-
|
489
|
-
class QueueDelete < ::FFI::Struct
|
490
|
-
layout :ticket, :uint16,
|
491
|
-
:queue, Bytes,
|
492
|
-
:if_unused, Boolean,
|
493
|
-
:if_empty, Boolean,
|
494
|
-
:nowait, Boolean
|
495
|
-
end
|
496
|
-
|
497
|
-
class QueueDeleteOk < ::FFI::Struct
|
498
|
-
layout :message_count, :uint32
|
499
|
-
end
|
500
|
-
|
501
|
-
class QueueUnbind < ::FFI::Struct
|
502
|
-
layout :ticket, :uint16,
|
503
|
-
:queue, Bytes,
|
504
|
-
:exchange, Bytes,
|
505
|
-
:routing_key, Bytes,
|
506
|
-
:arguments, Table
|
507
|
-
end
|
508
|
-
|
509
|
-
class QueueUnbindOk < ::FFI::Struct
|
510
|
-
layout :dummy, :char
|
511
|
-
end
|
512
|
-
|
513
|
-
class BasicQos < ::FFI::Struct
|
514
|
-
layout :prefetch_size, :uint32,
|
515
|
-
:prefetch_count, :uint16,
|
516
|
-
:global, Boolean
|
517
|
-
end
|
518
|
-
|
519
|
-
class BasicQosOk < ::FFI::Struct
|
520
|
-
layout :dummy, :char
|
521
|
-
end
|
522
|
-
|
523
|
-
class BasicConsume < ::FFI::Struct
|
524
|
-
layout :ticket, :uint16,
|
525
|
-
:queue, Bytes,
|
526
|
-
:consumer_tag, Bytes,
|
527
|
-
:no_local, Boolean,
|
528
|
-
:no_ack, Boolean,
|
529
|
-
:exclusive, Boolean,
|
530
|
-
:nowait, Boolean,
|
531
|
-
:arguments, Table
|
532
|
-
end
|
533
|
-
|
534
|
-
class BasicConsumeOk < ::FFI::Struct
|
535
|
-
layout :consumer_tag, Bytes
|
536
|
-
end
|
537
|
-
|
538
|
-
class BasicCancel < ::FFI::Struct
|
539
|
-
layout :consumer_tag, Bytes,
|
540
|
-
:nowait, Boolean
|
541
|
-
end
|
542
|
-
|
543
|
-
class BasicCancelOk < ::FFI::Struct
|
544
|
-
layout :consumer_tag, Bytes
|
545
|
-
end
|
546
|
-
|
547
|
-
class BasicPublish < ::FFI::Struct
|
548
|
-
layout :ticket, :uint16,
|
549
|
-
:exchange, Bytes,
|
550
|
-
:routing_key, Bytes,
|
551
|
-
:mandatory, Boolean,
|
552
|
-
:immediate, Boolean
|
553
|
-
end
|
554
|
-
|
555
|
-
class BasicReturn < ::FFI::Struct
|
556
|
-
layout :reply_code, :uint16,
|
557
|
-
:reply_text, Bytes,
|
558
|
-
:exchange, Bytes,
|
559
|
-
:routing_key, Bytes
|
560
|
-
end
|
561
|
-
|
562
|
-
class BasicDeliver < ::FFI::Struct
|
563
|
-
layout :consumer_tag, Bytes,
|
564
|
-
:delivery_tag, :uint64,
|
565
|
-
:redelivered, Boolean,
|
566
|
-
:exchange, Bytes,
|
567
|
-
:routing_key, Bytes
|
568
|
-
end
|
569
|
-
|
570
|
-
class BasicGet < ::FFI::Struct
|
571
|
-
layout :ticket, :uint16,
|
572
|
-
:queue, Bytes,
|
573
|
-
:no_ack, Boolean
|
574
|
-
end
|
575
|
-
|
576
|
-
class BasicGetOk < ::FFI::Struct
|
577
|
-
layout :delivery_tag, :uint64,
|
578
|
-
:redelivered, Boolean,
|
579
|
-
:exchange, Bytes,
|
580
|
-
:routing_key, Bytes,
|
581
|
-
:message_count, :uint32
|
582
|
-
end
|
583
|
-
|
584
|
-
class BasicGetEmpty < ::FFI::Struct
|
585
|
-
layout :cluster_id, Bytes
|
586
|
-
end
|
587
|
-
|
588
|
-
class BasicAck < ::FFI::Struct
|
589
|
-
layout :delivery_tag, :uint64,
|
590
|
-
:multiple, Boolean
|
591
|
-
end
|
592
|
-
|
593
|
-
class BasicReject < ::FFI::Struct
|
594
|
-
layout :delivery_tag, :uint64,
|
595
|
-
:requeue, Boolean
|
596
|
-
end
|
597
|
-
|
598
|
-
class BasicRecoverAsync < ::FFI::Struct
|
599
|
-
layout :requeue, Boolean
|
600
|
-
end
|
601
|
-
|
602
|
-
class BasicRecover < ::FFI::Struct
|
603
|
-
layout :requeue, Boolean
|
604
|
-
end
|
605
|
-
|
606
|
-
class BasicRecoverOk < ::FFI::Struct
|
607
|
-
layout :dummy, :char
|
608
|
-
end
|
609
|
-
|
610
|
-
class BasicNack < ::FFI::Struct
|
611
|
-
layout :delivery_tag, :uint64,
|
612
|
-
:multiple, Boolean,
|
613
|
-
:requeue, Boolean
|
614
|
-
end
|
615
|
-
|
616
|
-
class TxSelect < ::FFI::Struct
|
617
|
-
layout :dummy, :char
|
618
|
-
end
|
619
|
-
|
620
|
-
class TxSelectOk < ::FFI::Struct
|
621
|
-
layout :dummy, :char
|
622
|
-
end
|
623
|
-
|
624
|
-
class TxCommit < ::FFI::Struct
|
625
|
-
layout :dummy, :char
|
626
|
-
end
|
627
|
-
|
628
|
-
class TxCommitOk < ::FFI::Struct
|
629
|
-
layout :dummy, :char
|
630
|
-
end
|
631
|
-
|
632
|
-
class TxRollback < ::FFI::Struct
|
633
|
-
layout :dummy, :char
|
634
|
-
end
|
635
|
-
|
636
|
-
class TxRollbackOk < ::FFI::Struct
|
637
|
-
layout :dummy, :char
|
638
|
-
end
|
639
|
-
|
640
|
-
class ConfirmSelect < ::FFI::Struct
|
641
|
-
layout :nowait, Boolean
|
642
|
-
end
|
643
|
-
|
644
|
-
class ConfirmSelectOk < ::FFI::Struct
|
645
|
-
layout :dummy, :char
|
646
|
-
end
|
294
|
+
require_relative 'ffi/gen'
|
647
295
|
|
648
296
|
class ConnectionProperties < ::FFI::Struct
|
649
297
|
layout :flags, Flags,
|