public
Rubygem
Description: AMQP client implementation in Ruby/EventMachine
Homepage: http://groups.google.com/group/ruby-amqp
Clone URL: git://github.com/tmm1/amqp.git
reorganize examples
tmm1 (author)
Fri Jul 25 01:35:49 -0700 2008
commit  5c7cbd8bb410cfdbf0df8f37d03d7ef83f86a4f2
tree    e2456bd6025d134311f0abdea1517bdc69ef2d7d
parent  8320202b5d525fa172c89e2466a398c89d6ed217
0
...
19
20
21
22
23
24
25
26
 
 
 
 
 
 
 
27
28
29
30
 
31
32
33
...
19
20
21
 
 
 
 
 
22
23
24
25
26
27
28
29
30
31
 
32
33
34
35
0
@@ -19,15 +19,17 @@ To use with RabbitMQ, first run the server:
0
 
0
 To get started, refer to the various bundled examples:
0
 
0
- ruby examples/pingpong.rb # 1-1 communication using amq.direct
0
- ruby examples/clock.rb # 1-N communication using amq.fanout
0
- ruby examples/stocks.rb # 1-subscriber communication using amq.topic
0
- ruby examples/hashtable.rb # simple async rpc layer
0
- ruby examples/primes.rb 4 # parallelized prime number generation
0
+ ruby examples/mq/simple.rb # low-level Queue/Exchange api
0
+ ruby examples/mq/pingpong.rb # 1-1 communication using amq.direct
0
+ ruby examples/mq/clock.rb # 1-N communication using amq.fanout
0
+ ruby examples/mq/stocks.rb # 1-subscriber communication using amq.topic
0
+ ruby examples/mq/hashtable.rb # simple async rpc layer
0
+ ruby examples/mq/primes.rb 4 # parallelized prime number generation
0
+ ruby examples/mq/logger.rb # simple logging api
0
 
0
 For more details into the lower level AMQP client API, run the simple client example:
0
 
0
- ruby examples/simple.rb
0
+ ruby examples/amqp/simple.rb # low-level AMQP api
0
 
0
 Or refer to protocol/doc.txt, which enumerates packets sent between a server and client
0
 during a typical session, in both binary and decoded formats.
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
129
130
131
 
 
 
 
 
 
 
 
132
133
134
...
107
108
109
 
 
 
 
 
 
 
 
110
111
112
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
0
@@ -107,14 +107,6 @@ class MQ
0
     @closing = true
0
   end
0
 
0
- private
0
-
0
- def log *args
0
- return unless MQ.logging
0
- pp args
0
- puts
0
- end
0
-
0
   # keep track of proxy objects
0
   
0
   def exchanges
0
@@ -129,6 +121,14 @@ class MQ
0
     @rcps ||= {}
0
   end
0
 
0
+ private
0
+
0
+ def log *args
0
+ return unless MQ.logging
0
+ pp args
0
+ puts
0
+ end
0
+
0
   # create a class level connection on demand
0
 
0
   def connection
...
5
6
7
 
8
9
10
...
5
6
7
8
9
10
11
0
@@ -5,6 +5,7 @@ class MQ
0
     def initialize mq, type, name, opts = {}
0
       @mq = mq
0
       @type, @name = type, name
0
+ @mq.exchanges[@name = name] ||= self
0
       @key = opts[:key]
0
 
0
       @mq.callback{
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ class MQ
0
     
0
     def initialize mq, name, opts = {}
0
       @mq = mq
0
- @name = name
0
+ @mq.queues[@name = name] ||= self
0
       @mq.callback{
0
         @mq.send Protocol::Queue::Declare.new({ :queue => name,
0
                                                 :nowait => true }.merge(opts))
...
10
11
12
 
13
14
15
...
10
11
12
13
14
15
16
0
@@ -10,6 +10,7 @@ class MQ
0
   class RPC < BlankSlate
0
     def initialize mq, queue, obj = nil
0
       @mq = mq
0
+ @mq.rpcs[queue] ||= self
0
 
0
       if obj
0
         @obj = case obj

Comments

    No one has commented yet.