amqp 0.6.0 → 0.6.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.
data/lib/amqp/protocol.rb CHANGED
@@ -32,7 +32,7 @@ module AMQP
32
32
 
33
33
  def to_binary
34
34
  buf = Buffer.new
35
- buf.write :short, self.class.parent.id
35
+ buf.write :short, self.class.section.id
36
36
  buf.write :short, self.class.id
37
37
 
38
38
  bits = []
@@ -0,0 +1,99 @@
1
+ require 'amqp/frame'
2
+
3
+ module AMQP
4
+ module Server
5
+ def post_init
6
+ @buf = ''
7
+ @channels = {}
8
+ @started = false
9
+ end
10
+
11
+ def receive_data data
12
+ @buf << data
13
+
14
+ unless @started
15
+ if @buf.size >= 8
16
+ if @buf.slice!(0,8) == "AMQP\001\001\b\000"
17
+ send Protocol::Connection::Start.new(
18
+ 8,
19
+ 0,
20
+ {
21
+ :information => 'Licensed under the Ruby license. See http://github.com/tmm1/amqp',
22
+ :copyright => 'Copyright (c) 2008-2009 Aman Gupta',
23
+ :platform => 'Ruby/EventMachine',
24
+ :version => '0.6.1',
25
+ :product => 'SquirrelMQ'
26
+ },
27
+ 'PLAIN AMQPLAIN',
28
+ 'en_US'
29
+ )
30
+ else
31
+ close_connection
32
+ return
33
+ end
34
+ @started = true
35
+ else
36
+ return
37
+ end
38
+ end
39
+
40
+ while frame = Frame.parse(@buf)
41
+ process_frame frame
42
+ end
43
+ end
44
+
45
+ def process_frame frame
46
+ channel = frame.channel
47
+
48
+ case method = frame.payload
49
+ when Protocol::Connection::StartOk
50
+ @user = method.response[:LOGIN]
51
+ @pass = method.response[:PASSWORD]
52
+ send Protocol::Connection::Tune.new(0, 131072, 0)
53
+
54
+ when Protocol::Connection::TuneOk
55
+ # mnnk
56
+
57
+ when Protocol::Connection::Open
58
+ @vhost = method.virtual_host
59
+ send Protocol::Connection::OpenOk.new('localhost')
60
+
61
+ when Protocol::Channel::Open
62
+ @channels[channel] = []
63
+ send Protocol::Channel::OpenOk.new, :channel => channel
64
+
65
+ when Protocol::Access::Request
66
+ send Protocol::Access::RequestOk.new(101)
67
+ end
68
+ end
69
+
70
+ def send data, opts = {}
71
+ channel = opts[:channel] ||= 0
72
+ data = data.to_frame(channel) unless data.is_a? Frame
73
+ data.channel = channel
74
+
75
+ log 'send', data
76
+ send_data data.to_s
77
+ end
78
+
79
+ def self.start host = 'localhost', port = 5672
80
+ EM.start_server host, port, self
81
+ end
82
+
83
+ private
84
+
85
+ def log *args
86
+ require 'pp'
87
+ pp args
88
+ puts
89
+ end
90
+ end
91
+ end
92
+
93
+ if __FILE__ == $0
94
+ require 'rubygems'
95
+ require 'eventmachine'
96
+ EM.run{
97
+ AMQP::Server.start
98
+ }
99
+ end
data/lib/amqp/spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  #:stopdoc:
3
- # this file was autogenerated on Sat Jan 03 14:05:57 -0600 2009
3
+ # this file was autogenerated on Thu Jul 09 15:17:33 -0700 2009
4
4
  # using amqp-0.8.json (mtime: Sat Jan 03 08:58:13 -0600 2009)
5
5
  #
6
6
  # DO NOT EDIT! (edit protocol/codegen.rb instead, and run `rake codegen`)
@@ -96,9 +96,9 @@ module AMQP
96
96
 
97
97
  def arguments() @arguments ||= [] end
98
98
 
99
- def parent() Protocol.const_get(self.to_s[/Protocol::(.+?)::/,1]) end
100
- def id() self::ID end
101
- def name() self::NAME end
99
+ def section() Protocol.const_get(self.to_s[/Protocol::(.+?)::/,1]) end
100
+ def id() self::ID end
101
+ def name() self::NAME end
102
102
  end
103
103
 
104
104
  def == b
@@ -117,8 +117,8 @@ module AMQP
117
117
  def self.inherited klass
118
118
  klass.const_set(:ID, #{id})
119
119
  klass.const_set(:NAME, :#{name.to_s})
120
- klass.parent.methods[#{id}] = klass
121
- klass.parent.methods[klass::NAME] = klass
120
+ klass.section.methods[#{id}] = klass
121
+ klass.section.methods[klass::NAME] = klass
122
122
  end
123
123
  ]
124
124
  end
data/lib/ext/emfork.rb CHANGED
@@ -46,7 +46,7 @@ def EM.fork num = 1, &blk
46
46
  end
47
47
 
48
48
  def EM.forks
49
- @forks.keys
49
+ @forks ? @forks.keys : []
50
50
  end
51
51
 
52
52
  if EMFORK
data/lib/mq.rb CHANGED
@@ -145,7 +145,7 @@ class MQ
145
145
  send Protocol::Channel::Open.new
146
146
  }
147
147
  end
148
- attr_reader :channel
148
+ attr_reader :channel, :connection
149
149
 
150
150
  # May raise a MQ::Error exception when the frame payload contains a
151
151
  # Protocol::Channel::Close object.
@@ -215,8 +215,11 @@ class MQ
215
215
  end
216
216
 
217
217
  when Protocol::Basic::GetEmpty
218
- @consumer = get_queue{|q| q.shift }
219
- @consumer.receive nil, nil
218
+ if @consumer = get_queue{|q| q.shift }
219
+ @consumer.receive nil, nil
220
+ else
221
+ MQ.error "Basic.GetEmpty for invalid consumer"
222
+ end
220
223
 
221
224
  when Protocol::Channel::Close
222
225
  raise Error, "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]} on #{@channel}"
@@ -517,7 +520,87 @@ class MQ
517
520
  def topic name = 'amq.topic', opts = {}
518
521
  exchanges[name] ||= Exchange.new(self, :topic, name, opts)
519
522
  end
520
-
523
+
524
+ # Defines, intializes and returns an Exchange to act as an ingress
525
+ # point for all published messages.
526
+ #
527
+ # == Headers
528
+ # A headers exchange allows for messages to be published to an exchange
529
+ #
530
+ # Any published message, regardless of its persistence setting, is thrown
531
+ # away by the exchange when there are no queues bound to it.
532
+ #
533
+ # As part of the AMQP standard, each server _should_ predeclare a headers
534
+ # exchange called 'amq.match' (this is not required by the standard).
535
+ # Allocating this exchange without a name _or_ with the empty string
536
+ # will use the internal 'amq.match' exchange.
537
+ #
538
+ # TODO: The classic example is ...
539
+ #
540
+ # When publishing data to the exchange, bound queues subscribing to the
541
+ # exchange indicate which data interests them by passing arguments
542
+ # for matching against the headers in published messages. The
543
+ # form of the matching can be controlled by the 'x-match' argument, which
544
+ # may be 'any' or 'all'. If unspecified (in RabbitMQ at least), it defaults
545
+ # to "all".
546
+ #
547
+ # A value of 'all' for 'x-match' implies that all values must match (i.e.
548
+ # it does an AND of the headers ), while a value of 'any' implies that
549
+ # at least one should match (ie. it does an OR).
550
+ #
551
+ # TODO: document behavior when either the binding or the message is missing
552
+ # a header present in the other
553
+ #
554
+ # TODO: insert example
555
+ #
556
+ # == Options
557
+ # * :passive => true | false (default false)
558
+ # If set, the server will not create the exchange if it does not
559
+ # already exist. The client can use this to check whether an exchange
560
+ # exists without modifying the server state.
561
+ #
562
+ # * :durable => true | false (default false)
563
+ # If set when creating a new exchange, the exchange will be marked as
564
+ # durable. Durable exchanges remain active when a server restarts.
565
+ # Non-durable exchanges (transient exchanges) are purged if/when a
566
+ # server restarts.
567
+ #
568
+ # A transient exchange (the default) is stored in memory-only. The
569
+ # exchange and all bindings will be lost on a server restart.
570
+ # It makes no sense to publish a persistent message to a transient
571
+ # exchange.
572
+ #
573
+ # Durable exchanges and their bindings are recreated upon a server
574
+ # restart. Any published messages not routed to a bound queue are lost.
575
+ #
576
+ # * :auto_delete => true | false (default false)
577
+ # If set, the exchange is deleted when all queues have finished
578
+ # using it. The server waits for a short period of time before
579
+ # determining the exchange is unused to give time to the client code
580
+ # to bind a queue to it.
581
+ #
582
+ # If the exchange has been previously declared, this option is ignored
583
+ # on subsequent declarations.
584
+ #
585
+ # * :internal => true | false (default false)
586
+ # If set, the exchange may not be used directly by publishers, but
587
+ # only when bound to other exchanges. Internal exchanges are used to
588
+ # construct wiring that is not visible to applications.
589
+ #
590
+ # * :nowait => true | false (default true)
591
+ # If set, the server will not respond to the method. The client should
592
+ # not wait for a reply method. If the server could not complete the
593
+ # method it will raise a channel or connection exception.
594
+ #
595
+ # == Exceptions
596
+ # Doing any of these activities are illegal and will raise MQ:Error.
597
+ # * redeclare an already-declared exchange to a different type
598
+ # * :passive => true and the exchange does not exist (NOT_FOUND)
599
+ # * using a value other than "any" or "all" for "x-match"
600
+ def headers name = 'amq.match', opts = {}
601
+ exchanges[name] ||= Exchange.new(self, :headers, name, opts)
602
+ end
603
+
521
604
  # Queues store and forward messages. Queues can be configured in the server
522
605
  # or created at runtime. Queues must be attached to at least one exchange
523
606
  # in order to receive messages from publishers.
@@ -649,6 +732,10 @@ class MQ
649
732
  end
650
733
  end
651
734
 
735
+ def prefetch(size)
736
+ send Protocol::Basic::Qos.new(:prefetch_size => 0, :prefetch_count => size, :global => false)
737
+ end
738
+
652
739
  # Returns a hash of all the exchange proxy objects.
653
740
  #
654
741
  # Not typically called by client code.
data/lib/mq/queue.rb CHANGED
@@ -236,12 +236,12 @@ class MQ
236
236
  end
237
237
 
238
238
  @mq.callback{
239
- @mq.send Protocol::Basic::Get.new({ :queue => name,
240
- :consumer_tag => name,
241
- :no_ack => !opts.delete(:ack),
242
- :nowait => true }.merge(opts))
243
239
  @mq.get_queue{ |q|
244
240
  q.push(self)
241
+ @mq.send Protocol::Basic::Get.new({ :queue => name,
242
+ :consumer_tag => name,
243
+ :no_ack => !opts.delete(:ack),
244
+ :nowait => true }.merge(opts))
245
245
  }
246
246
  }
247
247
 
@@ -376,6 +376,12 @@ class MQ
376
376
  end
377
377
  end
378
378
 
379
+ # Get the number of messages and consumers on a queue.
380
+ #
381
+ # MQ.queue('name').status{ |num_messages, num_consumers|
382
+ # puts num_messages
383
+ # }
384
+ #
379
385
  def status opts = {}, &blk
380
386
  @on_status = blk
381
387
  @mq.callback{
data/lib/mq/rpc.rb CHANGED
@@ -54,10 +54,12 @@ class MQ
54
54
  obj
55
55
  end
56
56
 
57
- @mq.queue(queue).subscribe{ |info, request|
57
+ @mq.queue(queue).subscribe(:ack=>true){ |info, request|
58
58
  method, *args = ::Marshal.load(request)
59
59
  ret = @obj.__send__(method, *args)
60
60
 
61
+ info.ack
62
+
61
63
  if info.reply_to
62
64
  @mq.queue(info.reply_to).publish(::Marshal.dump(ret), :key => info.reply_to, :message_id => info.message_id)
63
65
  end
data/old/README ADDED
@@ -0,0 +1,30 @@
1
+ Simple AMQP client for Ruby/EventMachine.
2
+
3
+ To use with RabbitMQ, first run the server:
4
+
5
+ hg clone http://hg.rabbitmq.com/rabbitmq-codegen
6
+ hg clone http://hg.rabbitmq.com/rabbitmq-server
7
+ cd rabbitmq-server
8
+ make run
9
+
10
+ Then run the client:
11
+
12
+ ruby amqpc.rb
13
+
14
+ The client includes some basic specs (requires bacon >= 0.9.10). To run them:
15
+
16
+ bacon amqpc.rb
17
+
18
+ The amqp_spec.rb file is generated automatically based on the AMQP specification. To generate it:
19
+
20
+ ruby codegen.rb > amqp_spec.rb
21
+
22
+ This project was inspired by py-amqplib, rabbitmq, qpid and rubbyt.
23
+ Special thanks go to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
24
+
25
+ Other AMQP resources:
26
+
27
+ Barry Pederson's py-amqplib: http://barryp.org/software/py-amqplib/
28
+ Ben Hood's article on writing an AMQP article: http://hopper.squarespace.com/blog/2008/6/21/build-your-own-amqp-client.html
29
+ Dmitriy Samovskiy's introduction to ruby+rabbitmq: http://somic-org.homelinux.org/blog/2008/06/24/ruby-amqp-rabbitmq-example/
30
+ Ben Hood's AMQP client in AS3: http://github.com/0x6e6562/as3-amqp
data/old/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ task :codegen do
2
+ sh 'ruby codegen.rb > amqp_spec.rb'
3
+ sh 'ruby amqp_spec.rb'
4
+ end
5
+
6
+ task :spec do
7
+ sh 'bacon amqpc.rb'
8
+ end
9
+
10
+ task :test do
11
+ sh 'ruby amqpc.rb'
12
+ end
data/old/amqp-0.8.json ADDED
@@ -0,0 +1,606 @@
1
+ /*
2
+ Copyright (c) 2008 John Leuner
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this file (the "Software"), to deal in the
6
+ Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute,
8
+ sublicense, and/or sell copies of the Software, and to permit
9
+ persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf
25
+
26
+ b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf
27
+ http://www.twiststandards.org/index.php?option=com_docman&task=cat_view&gid=28&&Itemid=90
28
+ 8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf
29
+ https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1
30
+ */
31
+
32
+ {
33
+ "name": "AMQP",
34
+ "major-version": 8,
35
+ "minor-version": 0,
36
+ "port": 5672,
37
+
38
+ "domains": [
39
+ ["access-ticket", "short"],
40
+ ["bit", "bit"],
41
+ ["channel-id", "longstr"],
42
+ ["class-id", "short"],
43
+ ["consumer-tag", "shortstr"],
44
+ ["delivery-tag", "longlong"],
45
+ ["destination", "shortstr"],
46
+ ["duration", "longlong"],
47
+ ["exchange-name", "shortstr"],
48
+ ["known-hosts", "shortstr"],
49
+ ["long", "long"],
50
+ ["longlong", "longlong"],
51
+ ["longstr", "longstr"],
52
+ ["method-id", "short"],
53
+ ["no-ack", "bit"],
54
+ ["no-local", "bit"],
55
+ ["octet", "octet"],
56
+ ["offset", "longlong"],
57
+ ["path", "shortstr"],
58
+ ["peer-properties", "table"],
59
+ ["queue-name", "shortstr"],
60
+ ["redelivered", "bit"],
61
+ ["reference", "longstr"],
62
+ ["reject-code", "short"],
63
+ ["reject-text", "shortstr"],
64
+ ["reply-code", "short"],
65
+ ["reply-text", "shortstr"],
66
+ ["security-token", "longstr"],
67
+ ["short", "short"],
68
+ ["shortstr", "shortstr"],
69
+ ["table", "table"],
70
+ ["timestamp", "timestamp"]
71
+ ],
72
+
73
+ "constants": [
74
+ {"name": "FRAME-METHOD", "value": 1},
75
+ {"name": "FRAME-HEADER", "value": 2},
76
+ {"name": "FRAME-BODY", "value": 3},
77
+ {"name": "FRAME-OOB-METHOD", "value": 4},
78
+ {"name": "FRAME-OOB-HEADER", "value": 5},
79
+ {"name": "FRAME-OOB-BODY", "value": 6},
80
+ {"name": "FRAME-TRACE", "value": 7},
81
+ {"name": "FRAME-HEARTBEAT", "value": 8},
82
+ {"name": "FRAME-MIN-SIZE", "value": 4096},
83
+ {"name": "FRAME-END", "value": 206},
84
+ {"name": "REPLY-SUCCESS", "value": 200},
85
+ {"name": "NOT-DELIVERED", "value": 310, "class": "soft-error"},
86
+ {"name": "CONTENT-TOO-LARGE", "value": 311, "class": "soft-error"},
87
+ {"name": "NO-ROUTE", "value": 312, "class": "soft-error"},
88
+ {"name": "NO-CONSUMERS", "value": 313, "class": "soft-error"},
89
+ {"name": "ACCESS-REFUSED", "value": 403, "class": "soft-error"},
90
+ {"name": "NOT-FOUND", "value": 404, "class": "soft-error"},
91
+ {"name": "RESOURCE-LOCKED", "value": 405, "class": "soft-error"},
92
+ {"name": "PRECONDITION-FAILED", "value": 406, "class": "soft-error"},
93
+ {"name": "CONNECTION-FORCED", "value": 320, "class": "hard-error"},
94
+ {"name": "INVALID-PATH", "value": 402, "class": "hard-error"},
95
+ {"name": "FRAME-ERROR", "value": 501, "class": "hard-error"},
96
+ {"name": "SYNTAX-ERROR", "value": 502, "class": "hard-error"},
97
+ {"name": "COMMAND-INVALID", "value": 503, "class": "hard-error"},
98
+ {"name": "CHANNEL-ERROR", "value": 504, "class": "hard-error"},
99
+ {"name": "RESOURCE-ERROR", "value": 506, "class": "hard-error"},
100
+ {"name": "NOT-ALLOWED", "value": 530, "class": "hard-error"},
101
+ {"name": "NOT-IMPLEMENTED", "value": 540, "class": "hard-error"},
102
+ {"name": "INTERNAL-ERROR", "value": 541, "class": "hard-error"}
103
+ ],
104
+
105
+ "classes": [
106
+ {
107
+ "id": 10,
108
+ "methods": [{"id": 10,
109
+ "arguments": [{"type": "octet", "name": "version-major"},
110
+ {"type": "octet", "name": "version-minor"},
111
+ {"domain": "peer-properties", "name": "server properties"},
112
+ {"type": "longstr", "name": "mechanisms"},
113
+ {"type": "longstr", "name": "locales"}],
114
+ "name": "start"},
115
+ {"id": 11,
116
+ "arguments": [{"domain": "peer-properties", "name": "client-properties"},
117
+ {"type": "shortstr", "name": "mechanism"},
118
+ {"type": "longstr", "name": "response"},
119
+ {"type": "shortstr", "name": "locale"}],
120
+ "name": "start-ok"},
121
+ {"id": 20,
122
+ "arguments": [{"type": "longstr", "name": "challenge"}],
123
+ "name": "secure"},
124
+ {"id": 21,
125
+ "arguments": [{"type": "longstr", "name": "response"}],
126
+ "name": "secure-ok"},
127
+ {"id": 30,
128
+ "arguments": [{"type": "short", "name": "channel-max"},
129
+ {"type": "long", "name": "frame-max"},
130
+ {"type": "short", "name": "heartbeat"}],
131
+ "name": "tune"},
132
+ {"id": 31,
133
+ "arguments": [{"type": "short", "name": "channel-max"},
134
+ {"type": "long", "name": "frame-max"},
135
+ {"type": "short", "name": "heartbeat"}],
136
+ "name": "tune-ok"},
137
+ {"id": 40,
138
+ "arguments": [{"type": "shortstr", "name": "virtual-host"},
139
+ {"type": "shortstr", "name": "capabilities"},
140
+ {"type": "bit", "name": "insist"}],
141
+ "name": "open"},
142
+ {"id": 41,
143
+ "arguments": [{"type": "shortstr", "name": "known-hosts"}],
144
+ "name": "open-ok"},
145
+ {"id": 50,
146
+ "arguments": [{"type": "shortstr", "name": "host"},
147
+ {"type": "shortstr", "name": "known-hosts"}],
148
+ "name": "redirect"},
149
+ {"id": 60,
150
+ "arguments": [{"type": "short", "name": "reply-code"},
151
+ {"type": "shortstr", "name": "reply-text"},
152
+ {"type": "short", "name": "class-id"},
153
+ {"type": "short", "name": "method-id"}],
154
+ "name": "close"},
155
+ {"id": 61,
156
+ "arguments": [],
157
+ "name": "close-ok"}],
158
+ "name": "connection",
159
+ "properties": []
160
+ },
161
+ {
162
+ "id": 20,
163
+ "methods": [{"id": 10,
164
+ "arguments": [{"type": "shortstr", "name": "out-of-band"}],
165
+ "name": "open"},
166
+ {"id": 11,
167
+ "arguments": [],
168
+ "name": "open-ok"},
169
+ {"id": 20,
170
+ "arguments": [{"type": "bit", "name": "active"}],
171
+ "name": "flow"},
172
+ {"id": 21,
173
+ "arguments": [{"type": "bit", "name": "active"}],
174
+ "name": "flow-ok"},
175
+ {"id": 30,
176
+ "arguments": [{"type": "short", "name": "reply-code"},
177
+ {"type": "shortstr", "name": "reply-text"},
178
+ {"type": "table", "name": "details"}],
179
+ "name": "alert"},
180
+ {"id": 40,
181
+ "arguments": [{"type": "short", "name": "reply-code"},
182
+ {"type": "shortstr", "name": "reply-text"},
183
+ {"type": "short", "name": "class-id"},
184
+ {"type": "short", "name": "method-id"}],
185
+ "name": "close"},
186
+ {"id": 41,
187
+ "arguments": [],
188
+ "name": "close-ok"}],
189
+ "name": "channel"
190
+ },
191
+ {
192
+ "id": 30,
193
+ "methods": [{"id": 10,
194
+ "arguments": [{"type": "shortstr", "name": "realm"},
195
+ {"type": "bit", "name": "exclusive"},
196
+ {"type": "bit", "name": "passive"},
197
+ {"type": "bit", "name": "active"},
198
+ {"type": "bit", "name": "write"},
199
+ {"type": "bit", "name": "read"}],
200
+ "name": "request"},
201
+ {"id": 11,
202
+ "arguments": [{"type": "short", "name": "ticket"}],
203
+ "name": "request-ok"}],
204
+ "name": "access"
205
+ },
206
+ {
207
+ "id": 40,
208
+ "methods": [{"id": 10,
209
+ "arguments": [{"type": "short", "name": "ticket"},
210
+ {"type": "shortstr", "name": "exchange"},
211
+ {"type": "shortstr", "name": "type"},
212
+ {"type": "bit", "name": "passive"},
213
+ {"type": "bit", "name": "durable"},
214
+ {"type": "bit", "name": "auto-delete"},
215
+ {"type": "bit", "name": "internal"},
216
+ {"type": "bit", "name": "nowait"},
217
+ {"type": "table", "name": "arguments"}],
218
+ "name": "declare"},
219
+ {"id": 11,
220
+ "arguments": [],
221
+ "name": "declare-ok"},
222
+ {"id": 20,
223
+ "arguments": [{"type": "short", "name": "ticket"},
224
+ {"type": "shortstr", "name": "exchange"},
225
+ {"type": "bit", "name": "if-unused"},
226
+ {"type": "bit", "name": "nowait"}],
227
+ "name": "delete"},
228
+ {"id": 21,
229
+ "arguments": [],
230
+ "name": "delete-ok"}],
231
+ "name": "exchange"
232
+ },
233
+ {
234
+ "id": 50,
235
+ "methods": [{"id": 10,
236
+ "arguments": [{"type": "short", "name": "ticket"},
237
+ {"type": "shortstr", "name": "queue"},
238
+ {"type": "bit", "name": "passive"},
239
+ {"type": "bit", "name": "durable"},
240
+ {"type": "bit", "name": "exclusive"},
241
+ {"type": "bit", "name": "auto-delete"},
242
+ {"type": "bit", "name": "nowait"},
243
+ {"type": "table", "name": "arguments"}],
244
+ "name": "declare"},
245
+ {"id": 11,
246
+ "arguments": [{"type": "shortstr", "name": "queue"},
247
+ {"type": "long", "name": "message-count"},
248
+ {"type": "long", "name": "consumer-count"}],
249
+ "name": "declare-ok"},
250
+ {"id": 20,
251
+ "arguments": [{"type": "short", "name": "ticket"},
252
+ {"type": "shortstr", "name": "queue"},
253
+ {"type": "shortstr", "name": "exchange"},
254
+ {"type": "shortstr", "name": "routing-key"},
255
+ {"type": "bit", "name": "nowait"},
256
+ {"type": "table", "name": "arguments"}],
257
+ "name": "bind"},
258
+ {"id": 21,
259
+ "arguments": [],
260
+ "name": "bind-ok"},
261
+ {"id": 30,
262
+ "arguments": [{"type": "short", "name": "ticket"},
263
+ {"type": "shortstr", "name": "queue"},
264
+ {"type": "bit", "name": "nowait"}],
265
+ "name": "purge"},
266
+ {"id": 31,
267
+ "arguments": [{"type": "long", "name": "message-count"}],
268
+ "name": "purge-ok"},
269
+ {"id": 40,
270
+ "arguments": [{"type": "short", "name": "ticket"},
271
+ {"type": "shortstr", "name": "queue"},
272
+ {"type": "bit", "name": "if-unused"},
273
+ {"type": "bit", "name": "if-empty"},
274
+ {"type": "bit", "name": "nowait"}],
275
+ "name": "delete"},
276
+ {"id": 41,
277
+ "arguments": [{"type": "long", "name": "message-count"}],
278
+ "name": "delete-ok"}],
279
+ "name": "queue"
280
+ },
281
+ {
282
+ "id": 60,
283
+ "methods": [{"id": 10,
284
+ "arguments": [{"type": "long", "name": "prefetch-size"},
285
+ {"type": "short", "name": "prefetch-count"},
286
+ {"type": "bit", "name": "global"}],
287
+ "name": "qos"},
288
+ {"id": 11,
289
+ "arguments": [],
290
+ "name": "qos-ok"},
291
+ {"id": 20,
292
+ "arguments": [{"domain": "access-ticket", "name": "ticket"},
293
+ {"domain": "queue-name", "name": "queue"},
294
+ {"type": "shortstr", "name": "consumer-tag"},
295
+ {"type": "bit", "name": "no-local"},
296
+ {"type": "bit", "name": "no-ack"},
297
+ {"type": "bit", "name": "exclusive"},
298
+ {"type": "bit", "name": "nowait"}],
299
+ "name": "consume"},
300
+ {"id": 21,
301
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
302
+ "name": "consume-ok"},
303
+ {"id": 30,
304
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
305
+ {"type": "bit", "name": "nowait"}],
306
+ "name": "cancel"},
307
+ {"id": 31,
308
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
309
+ "name": "cancel-ok"},
310
+ {"content": true,
311
+ "id": 40,
312
+ "arguments": [{"type": "short", "name": "ticket"},
313
+ {"type": "shortstr", "name": "exchange"},
314
+ {"type": "shortstr", "name": "routing-key"},
315
+ {"type": "bit", "name": "mandatory"},
316
+ {"type": "bit", "name": "immediate"}],
317
+ "name": "publish"},
318
+ {"content": true,
319
+ "id": 50,
320
+ "arguments": [{"type": "short", "name": "reply-code"},
321
+ {"type": "shortstr", "name": "reply-text"},
322
+ {"type": "shortstr", "name": "exchange"},
323
+ {"type": "shortstr", "name": "routing-key"}],
324
+ "name": "return"},
325
+ {"content": true,
326
+ "id": 60,
327
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
328
+ {"type": "longlong", "name": "delivery-tag"},
329
+ {"type": "bit", "name": "redelivered"},
330
+ {"type": "shortstr", "name": "exchange"},
331
+ {"type": "shortstr", "name": "routing-key"}],
332
+ "name": "deliver"},
333
+ {"id": 70,
334
+ "arguments": [{"type": "short", "name": "ticket"},
335
+ {"type": "shortstr", "name": "queue"},
336
+ {"type": "bit", "name": "no-ack"}],
337
+ "name": "get"},
338
+ {"content": true,
339
+ "id": 71,
340
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
341
+ {"type": "bit", "name": "redelivered"},
342
+ {"type": "shortstr", "name": "exchange"},
343
+ {"type": "shortstr", "name": "routing-key"},
344
+ {"type": "long", "name": "message-count"}],
345
+ "name": "get-ok"},
346
+ {"id": 72,
347
+ "arguments": [{"type": "shortstr", "name": "cluster-id"}],
348
+ "name": "get-empty"},
349
+ {"id": 80,
350
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
351
+ {"type": "bit", "name": "multiple"}],
352
+ "name": "ack"},
353
+ {"id": 90,
354
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
355
+ {"type": "bit", "name": "requeue"}],
356
+ "name": "reject"},
357
+ {"id": 100,
358
+ "arguments": [{"type": "bit", "name": "requeue"}],
359
+ "name": "recover"}],
360
+ "name": "basic",
361
+ "properties": [{"type": "shortstr", "name": "content-type"},
362
+ {"type": "shortstr", "name": "content-encoding"},
363
+ {"type": "table", "name": "headers"},
364
+ {"type": "octet", "name": "delivery-mode"},
365
+ {"type": "octet", "name": "priority"},
366
+ {"type": "shortstr", "name": "correlation-id"},
367
+ {"type": "shortstr", "name": "reply-to"},
368
+ {"type": "shortstr", "name": "expiration"},
369
+ {"type": "shortstr", "name": "message-id"},
370
+ {"type": "timestamp", "name": "timestamp"},
371
+ {"type": "shortstr", "name": "type"},
372
+ {"type": "shortstr", "name": "user-id"},
373
+ {"type": "shortstr", "name": "app-id"},
374
+ {"type": "shortstr", "name": "cluster-id"}]
375
+ },
376
+ {
377
+ "id": 70,
378
+ "methods": [{"id": 10,
379
+ "arguments": [{"type": "long", "name": "prefetch-size"},
380
+ {"type": "short", "name": "prefetch-count"},
381
+ {"type": "bit", "name": "global"}],
382
+ "name": "qos"},
383
+ {"id": 11,
384
+ "arguments": [],
385
+ "name": "qos-ok"},
386
+ {"id": 20,
387
+ "arguments": [{"type": "short", "name": "ticket"},
388
+ {"type": "shortstr", "name": "queue"},
389
+ {"type": "shortstr", "name": "consumer-tag"},
390
+ {"type": "bit", "name": "no-local"},
391
+ {"type": "bit", "name": "no-ack"},
392
+ {"type": "bit", "name": "exclusive"},
393
+ {"type": "bit", "name": "nowait"}],
394
+ "name": "consume"},
395
+ {"id": 21,
396
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
397
+ "name": "consume-ok"},
398
+ {"id": 30,
399
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
400
+ {"type": "bit", "name": "nowait"}],
401
+ "name": "cancel"},
402
+ {"id": 31,
403
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
404
+ "name": "cancel-ok"},
405
+ {"id": 40,
406
+ "arguments": [{"type": "shortstr", "name": "identifier"},
407
+ {"type": "longlong", "name": "content-size"}],
408
+ "name": "open"},
409
+ {"id": 41,
410
+ "arguments": [{"type": "longlong", "name": "staged-size"}],
411
+ "name": "open-ok"},
412
+ {"content": true,
413
+ "id": 50,
414
+ "arguments": [],
415
+ "name": "stage"},
416
+ {"id": 60,
417
+ "arguments": [{"type": "short", "name": "ticket"},
418
+ {"type": "shortstr", "name": "exchange"},
419
+ {"type": "shortstr", "name": "routing-key"},
420
+ {"type": "bit", "name": "mandatory"},
421
+ {"type": "bit", "name": "immediate"},
422
+ {"type": "shortstr", "name": "identifier"}],
423
+ "name": "publish"},
424
+ {"content": true,
425
+ "id": 70,
426
+ "arguments": [{"type": "short", "name": "reply-code"},
427
+ {"type": "shortstr", "name": "reply-text"},
428
+ {"type": "shortstr", "name": "exchange"},
429
+ {"type": "shortstr", "name": "routing-key"}],
430
+ "name": "return"},
431
+ {"id": 80,
432
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
433
+ {"type": "longlong", "name": "delivery-tag"},
434
+ {"type": "bit", "name": "redelivered"},
435
+ {"type": "shortstr", "name": "exchange"},
436
+ {"type": "shortstr", "name": "routing-key"},
437
+ {"type": "shortstr", "name": "identifier"}],
438
+ "name": "deliver"},
439
+ {"id": 90,
440
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
441
+ {"type": "bit", "name": "multiple"}],
442
+ "name": "ack"},
443
+ {"id": 100,
444
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
445
+ {"type": "bit", "name": "requeue"}],
446
+ "name": "reject"}],
447
+ "name": "file",
448
+ "properties": [{"type": "shortstr", "name": "content-type"},
449
+ {"type": "shortstr", "name": "content-encoding"},
450
+ {"type": "table", "name": "headers"},
451
+ {"type": "octet", "name": "priority"},
452
+ {"type": "shortstr", "name": "reply-to"},
453
+ {"type": "shortstr", "name": "message-id"},
454
+ {"type": "shortstr", "name": "filename"},
455
+ {"type": "timestamp", "name": "timestamp"},
456
+ {"type": "shortstr", "name": "cluster-id"}]
457
+ },
458
+ {
459
+ "id": 80,
460
+ "methods": [{"id": 10,
461
+ "arguments": [{"type": "long", "name": "prefetch-size"},
462
+ {"type": "short", "name": "prefetch-count"},
463
+ {"type": "long", "name": "consume-rate"},
464
+ {"type": "bit", "name": "global"}],
465
+ "name": "qos"},
466
+ {"id": 11,
467
+ "arguments": [],
468
+ "name": "qos-ok"},
469
+ {"id": 20,
470
+ "arguments": [{"type": "short", "name": "ticket"},
471
+ {"type": "shortstr", "name": "queue"},
472
+ {"type": "shortstr", "name": "consumer-tag"},
473
+ {"type": "bit", "name": "no-local"},
474
+ {"type": "bit", "name": "exclusive"},
475
+ {"type": "bit", "name": "nowait"}],
476
+ "name": "consume"},
477
+ {"id": 21,
478
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
479
+ "name": "consume-ok"},
480
+ {"id": 30,
481
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
482
+ {"type": "bit", "name": "nowait"}],
483
+ "name": "cancel"},
484
+ {"id": 31,
485
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
486
+ "name": "cancel-ok"},
487
+ {"content": true,
488
+ "id": 40,
489
+ "arguments": [{"type": "short", "name": "ticket"},
490
+ {"type": "shortstr", "name": "exchange"},
491
+ {"type": "shortstr", "name": "routing-key"},
492
+ {"type": "bit", "name": "mandatory"},
493
+ {"type": "bit", "name": "immediate"}],
494
+ "name": "publish"},
495
+ {"content": true,
496
+ "id": 50,
497
+ "arguments": [{"type": "short", "name": "reply-code"},
498
+ {"type": "shortstr", "name": "reply-text"},
499
+ {"type": "shortstr", "name": "exchange"},
500
+ {"type": "shortstr", "name": "routing-key"}],
501
+ "name": "return"},
502
+ {"content": true,
503
+ "id": 60,
504
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
505
+ {"type": "longlong", "name": "delivery-tag"},
506
+ {"type": "shortstr", "name": "exchange"},
507
+ {"type": "shortstr", "name": "queue"}],
508
+ "name": "deliver"}],
509
+ "name": "stream",
510
+ "properties": [{"type": "shortstr", "name": "content-type"},
511
+ {"type": "shortstr", "name": "content-encoding"},
512
+ {"type": "table", "name": "headers"},
513
+ {"type": "octet", "name": "priority"},
514
+ {"type": "timestamp", "name": "timestamp"}]
515
+ },
516
+ {
517
+ "id": 90,
518
+ "methods": [{"id": 10,
519
+ "arguments": [],
520
+ "name": "select"},
521
+ {"id": 11,
522
+ "arguments": [],
523
+ "name": "select-ok"},
524
+ {"id": 20,
525
+ "arguments": [],
526
+ "name": "commit"},
527
+ {"id": 21,
528
+ "arguments": [],
529
+ "name": "commit-ok"},
530
+ {"id": 30,
531
+ "arguments": [],
532
+ "name": "rollback"},
533
+ {"id": 31,
534
+ "arguments": [],
535
+ "name": "rollback-ok"}],
536
+ "name": "tx"
537
+ },
538
+ {
539
+ "id": 100,
540
+ "methods": [{"id": 10,
541
+ "arguments": [],
542
+ "name": "select"},
543
+ {"id": 11,
544
+ "arguments": [],
545
+ "name": "select-ok"},
546
+ {"id": 20,
547
+ "arguments": [{"type": "shortstr", "name": "dtx-identifier"}],
548
+ "name": "start"},
549
+ {"id": 21,
550
+ "arguments": [], "name": "start-ok"}],
551
+ "name": "dtx"
552
+ },
553
+ {
554
+ "id": 110,
555
+ "methods": [{"content": true,
556
+ "id": 10,
557
+ "arguments": [{"type": "table", "name": "meta-data"}],
558
+ "name": "request"}],
559
+ "name": "tunnel",
560
+ "properties": [{"type": "table", "name": "headers"},
561
+ {"type": "shortstr", "name": "proxy-name"},
562
+ {"type": "shortstr", "name": "data-name"},
563
+ {"type": "octet", "name": "durable"},
564
+ {"type": "octet", "name": "broadcast"}]
565
+ },
566
+ {
567
+ "id": 120,
568
+ "methods": [{"id": 10,
569
+ "arguments": [{"type": "octet", "name": "integer-1"},
570
+ {"type": "short", "name": "integer-2"},
571
+ {"type": "long", "name": "integer-3"},
572
+ {"type": "longlong", "name": "integer-4"},
573
+ {"type": "octet", "name": "operation"}],
574
+ "name": "integer"},
575
+ {"id": 11,
576
+ "arguments": [{"type": "longlong", "name": "result"}],
577
+ "name": "integer-ok"},
578
+ {"id": 20,
579
+ "arguments": [{"type": "shortstr", "name": "string-1"},
580
+ {"type": "longstr", "name": "string-2"},
581
+ {"type": "octet", "name": "operation"}],
582
+ "name": "string"},
583
+ {"id": 21,
584
+ "arguments": [{"type": "longstr", "name": "result"}],
585
+ "name": "string-ok"},
586
+ {"id": 30,
587
+ "arguments": [{"type": "table", "name": "table"},
588
+ {"type": "octet", "name": "integer-op"},
589
+ {"type": "octet", "name": "string-op"}],
590
+ "name": "table"},
591
+ {"id": 31,
592
+ "arguments": [{"type": "longlong", "name": "integer-result"},
593
+ {"type": "longstr", "name": "string-result"}],
594
+ "name": "table-ok"},
595
+ {"content": true,
596
+ "id": 40,
597
+ "arguments": [],
598
+ "name": "content"},
599
+ {"content": true,
600
+ "id": 41,
601
+ "arguments": [{"type": "long", "name": "content-checksum"}],
602
+ "name": "content-ok"}],
603
+ "name": "test"
604
+ }
605
+ ]
606
+ }