ruby_q 1.1.5 → 1.1.6
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.
- checksums.yaml +4 -4
- data/lib/message_queue_router.rb +8 -9
- data/lib/mq.rb +0 -2
- data/lib/r_message_queue.rb +0 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e76ac31c717da49735f8bca1614cb65e46967185
|
4
|
+
data.tar.gz: 14ceae84001daf21cb3b8faadb55b9cca5a95af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50b4e5c18d8b549771fddd56199e1ac5988bfe656527132c6005e50486302bdab1065ccb1df24713bfa63c6f60892ace2104d5705ff1db3c8f6ce15d3d20a2b3
|
7
|
+
data.tar.gz: 57e921bbd27ecf1bc7b2c28b8a2fbc7b2f4e21908748b437cb3d7ef7ce4c729c94a927aa8dd82e944517d0ebc66afb5ac98a47ac1e3f0394eaf99c469ad85154
|
data/lib/message_queue_router.rb
CHANGED
@@ -9,12 +9,10 @@ class Message_queue_router
|
|
9
9
|
action = input.gsub(/\s+/m,' ').strip.split(' ')[0]
|
10
10
|
name = input.gsub(/\s+/m,' ').strip.split(' ')[1]
|
11
11
|
msg = input[input.index(name)+name.length + 1..-1].gsub(/\r/," ").gsub(/\n/," ")
|
12
|
-
puts "Router message " + msg
|
13
12
|
ret = ''
|
14
13
|
command = input
|
15
|
-
#target_queue = queue_exists?(name)
|
16
14
|
|
17
|
-
if queue_exists?(name)
|
15
|
+
if !queue_exists?(name)
|
18
16
|
create_queue(name)
|
19
17
|
end
|
20
18
|
|
@@ -30,14 +28,15 @@ class Message_queue_router
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def use_queue(name, command, client)
|
33
|
-
|
34
|
-
|
31
|
+
rq = @mq_list.select { |q| q.name == name }[0]
|
32
|
+
puts rq
|
33
|
+
puts rq.name
|
34
|
+
while rq.in_use?
|
35
35
|
sleep 0.5
|
36
36
|
end
|
37
|
-
|
38
|
-
ret =
|
39
|
-
|
40
|
-
|
37
|
+
rq.lock
|
38
|
+
ret = rq.parse_command(command, client)
|
39
|
+
rq.unlock
|
41
40
|
return ret
|
42
41
|
end
|
43
42
|
|
data/lib/mq.rb
CHANGED
@@ -22,7 +22,6 @@ class MQStruct
|
|
22
22
|
return_string = 'nil'
|
23
23
|
if hasMessage
|
24
24
|
return_string = get_message(user).message
|
25
|
-
puts "Pulled " + return_string
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
@@ -39,7 +38,6 @@ class MQStruct
|
|
39
38
|
return return_string
|
40
39
|
end
|
41
40
|
def insert_message(message)
|
42
|
-
puts "Inserting " + message
|
43
41
|
queue << @msg_factory.create_message(message)
|
44
42
|
end
|
45
43
|
|
data/lib/r_message_queue.rb
CHANGED
@@ -22,7 +22,6 @@ class Ruby_q
|
|
22
22
|
server = TCPServer.open(port)
|
23
23
|
loop {
|
24
24
|
Thread.start(server.accept) do |client|
|
25
|
-
puts 'Connection from ' + client.addr.inspect
|
26
25
|
while 1 do
|
27
26
|
rx = client.gets
|
28
27
|
if rx.nil?
|
@@ -31,7 +30,6 @@ class Ruby_q
|
|
31
30
|
end
|
32
31
|
puts Time.now.getutc.to_s + ' - Client ' + client.addr.inspect + ' sent: ' + rx
|
33
32
|
client_return = @router.route(rx.gsub(/\r/," ").gsub(/\n/," "), client)
|
34
|
-
puts "Client return: " + client_return
|
35
33
|
client.puts client_return
|
36
34
|
end
|
37
35
|
#client.close
|