amqp 0.6.0 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -1
- data/Rakefile +15 -0
- data/amqp.gemspec +83 -0
- data/amqp.todo +32 -0
- data/doc/EXAMPLE_01_PINGPONG +2 -0
- data/doc/EXAMPLE_02_CLOCK +2 -0
- data/doc/EXAMPLE_03_STOCKS +2 -0
- data/doc/EXAMPLE_04_MULTICLOCK +2 -0
- data/doc/EXAMPLE_05_ACK +2 -0
- data/doc/EXAMPLE_05_POP +2 -0
- data/doc/EXAMPLE_06_HASHTABLE +2 -0
- data/examples/mq/{simple-ack.rb → ack.rb} +2 -3
- data/examples/mq/clock.rb +2 -2
- data/examples/mq/hashtable.rb +3 -3
- data/examples/mq/{simple.rb → internal.rb} +0 -0
- data/examples/mq/logger.rb +3 -3
- data/examples/mq/multiclock.rb +49 -0
- data/examples/mq/pingpong.rb +2 -2
- data/examples/mq/{simple-get.rb → pop.rb} +0 -0
- data/examples/mq/primes.rb +3 -3
- data/examples/mq/stocks.rb +2 -2
- data/lib/amqp.rb +14 -1
- data/lib/amqp/client.rb +32 -11
- data/lib/amqp/protocol.rb +1 -1
- data/lib/amqp/server.rb +99 -0
- data/lib/amqp/spec.rb +6 -6
- data/lib/ext/emfork.rb +1 -1
- data/lib/mq.rb +91 -4
- data/lib/mq/queue.rb +10 -4
- data/lib/mq/rpc.rb +3 -1
- data/old/README +30 -0
- data/old/Rakefile +12 -0
- data/old/amqp-0.8.json +606 -0
- data/old/amqp_spec.rb +796 -0
- data/old/amqpc.rb +695 -0
- data/old/codegen.rb +148 -0
- data/protocol/codegen.rb +5 -5
- data/research/api.rb +88 -0
- data/research/primes-forked.rb +63 -0
- data/research/primes-processes.rb +135 -0
- data/research/primes-threaded.rb +49 -0
- metadata +43 -12
@@ -0,0 +1,49 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'mq'
|
3
|
+
|
4
|
+
MAX = 500
|
5
|
+
|
6
|
+
def log *args
|
7
|
+
p args
|
8
|
+
end
|
9
|
+
|
10
|
+
# MQ.logging = true
|
11
|
+
|
12
|
+
EM.run{
|
13
|
+
|
14
|
+
# worker
|
15
|
+
|
16
|
+
log "prime checker", Process.pid, :started
|
17
|
+
|
18
|
+
class Fixnum
|
19
|
+
def prime?
|
20
|
+
('1' * self) !~ /^1?$|^(11+?)\1+$/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
MQ.queue('prime checker').subscribe{ |info, num|
|
25
|
+
EM.defer(proc{
|
26
|
+
|
27
|
+
log "prime checker #{Process.pid}-#{Thread.current.object_id}", :prime?, num
|
28
|
+
if Integer(num).prime?
|
29
|
+
MQ.queue(info.reply_to).publish(num, :reply_to => "#{Process.pid}-#{Thread.current.object_id}")
|
30
|
+
EM.stop_event_loop if num == '499'
|
31
|
+
end
|
32
|
+
|
33
|
+
})
|
34
|
+
}
|
35
|
+
|
36
|
+
# controller
|
37
|
+
|
38
|
+
MQ.queue('prime collector').subscribe{ |info, prime|
|
39
|
+
log 'prime collector', :received, prime, :from, info.reply_to
|
40
|
+
(@primes ||= []) << Integer(prime)
|
41
|
+
}
|
42
|
+
|
43
|
+
MAX.times do |i|
|
44
|
+
EM.next_tick do
|
45
|
+
MQ.queue('prime checker').publish((i+1).to_s, :reply_to => 'prime collector')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
}
|
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: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.12.
|
23
|
+
version: 0.12.4
|
24
24
|
version:
|
25
25
|
description: AMQP client implementation in Ruby/EventMachine
|
26
26
|
email: amqp@tmm1.net
|
@@ -30,43 +30,74 @@ extensions: []
|
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- README
|
33
|
+
- doc/EXAMPLE_01_PINGPONG
|
34
|
+
- doc/EXAMPLE_02_CLOCK
|
35
|
+
- doc/EXAMPLE_03_STOCKS
|
36
|
+
- doc/EXAMPLE_04_MULTICLOCK
|
37
|
+
- doc/EXAMPLE_05_ACK
|
38
|
+
- doc/EXAMPLE_05_POP
|
39
|
+
- doc/EXAMPLE_06_HASHTABLE
|
33
40
|
files:
|
34
41
|
- README
|
42
|
+
- Rakefile
|
43
|
+
- amqp.gemspec
|
44
|
+
- amqp.todo
|
45
|
+
- doc/EXAMPLE_01_PINGPONG
|
46
|
+
- doc/EXAMPLE_02_CLOCK
|
47
|
+
- doc/EXAMPLE_03_STOCKS
|
48
|
+
- doc/EXAMPLE_04_MULTICLOCK
|
49
|
+
- doc/EXAMPLE_05_ACK
|
50
|
+
- doc/EXAMPLE_05_POP
|
51
|
+
- doc/EXAMPLE_06_HASHTABLE
|
35
52
|
- examples/amqp/simple.rb
|
53
|
+
- examples/mq/ack.rb
|
36
54
|
- examples/mq/clock.rb
|
55
|
+
- examples/mq/pop.rb
|
37
56
|
- examples/mq/hashtable.rb
|
57
|
+
- examples/mq/internal.rb
|
38
58
|
- examples/mq/logger.rb
|
59
|
+
- examples/mq/multiclock.rb
|
39
60
|
- examples/mq/pingpong.rb
|
40
61
|
- examples/mq/primes-simple.rb
|
41
62
|
- examples/mq/primes.rb
|
42
|
-
- examples/mq/simple-ack.rb
|
43
|
-
- examples/mq/simple-get.rb
|
44
|
-
- examples/mq/simple.rb
|
45
63
|
- examples/mq/stocks.rb
|
64
|
+
- lib/amqp.rb
|
46
65
|
- lib/amqp/buffer.rb
|
47
66
|
- lib/amqp/client.rb
|
48
67
|
- lib/amqp/frame.rb
|
49
68
|
- lib/amqp/protocol.rb
|
69
|
+
- lib/amqp/server.rb
|
50
70
|
- lib/amqp/spec.rb
|
51
|
-
- lib/amqp.rb
|
52
71
|
- lib/ext/blankslate.rb
|
53
72
|
- lib/ext/em.rb
|
54
73
|
- lib/ext/emfork.rb
|
74
|
+
- lib/mq.rb
|
55
75
|
- lib/mq/exchange.rb
|
56
76
|
- lib/mq/header.rb
|
57
77
|
- lib/mq/logger.rb
|
58
78
|
- lib/mq/queue.rb
|
59
79
|
- lib/mq/rpc.rb
|
60
|
-
-
|
80
|
+
- old/README
|
81
|
+
- old/Rakefile
|
82
|
+
- old/amqp-0.8.json
|
83
|
+
- old/amqp_spec.rb
|
84
|
+
- old/amqpc.rb
|
85
|
+
- old/codegen.rb
|
61
86
|
- protocol/amqp-0.8.json
|
87
|
+
- protocol/amqp-0.8.xml
|
62
88
|
- protocol/codegen.rb
|
63
89
|
- protocol/doc.txt
|
64
|
-
-
|
90
|
+
- research/api.rb
|
91
|
+
- research/primes-forked.rb
|
92
|
+
- research/primes-processes.rb
|
93
|
+
- research/primes-threaded.rb
|
65
94
|
has_rdoc: true
|
66
95
|
homepage: http://amqp.rubyforge.org/
|
67
|
-
|
68
|
-
rdoc_options: []
|
96
|
+
licenses: []
|
69
97
|
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options:
|
100
|
+
- --include=examples
|
70
101
|
require_paths:
|
71
102
|
- lib
|
72
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -84,9 +115,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
115
|
requirements: []
|
85
116
|
|
86
117
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.3.
|
118
|
+
rubygems_version: 1.3.4
|
88
119
|
signing_key:
|
89
|
-
specification_version:
|
120
|
+
specification_version: 3
|
90
121
|
summary: AMQP client implementation in Ruby/EventMachine
|
91
122
|
test_files: []
|
92
123
|
|