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.
@@ -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.0
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.2
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
- - lib/mq.rb
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
- - protocol/amqp-0.8.xml
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
- post_install_message:
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.0
118
+ rubygems_version: 1.3.4
88
119
  signing_key:
89
- specification_version: 2
120
+ specification_version: 3
90
121
  summary: AMQP client implementation in Ruby/EventMachine
91
122
  test_files: []
92
123