-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
52 lines (38 loc) · 1.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require './lib/pubsub_redis'
namespace :ps do
task :chat do
puts 'starting chat client'
PubSubRedis::ChatClient.new.run
end
task :broker do
puts 'Broker started on default settings'
puts 'localhost:20000'
PubSubRedis::Broker.new.run
end
task :subscriber_one do
puts 'sample subscriber one'
puts "TOPICS: 'cars', 'money', 'girls'"
listener = PubSubRedis::Subscriber.new do |subscriber|
subscriber.enroll 'cars'
subscriber.enroll 'money'
subscriber.enroll 'girls'
end
listener.listen do |message|
something = 1 + 1
puts "[#{something}] MODIFIED MESSAGE #{message}"
end
end
task :subscriber_two do
puts 'sample subscriber two'
puts "TOPICS: 'money'"
listener = PubSubRedis::Subscriber.new
listener.enroll 'money'
listener.listen
end
task :publisher do
puts 'sample Publisher'
publisher = PubSubRedis::Publisher.new
publisher.execute(topic: 'money', body: 'money, money, money')
publisher.execute(topic: 'cars', body: 'I like cars!!')
end
end