basicjrpc 0.1.53 → 0.1.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/basicjrpc/client.rb +3 -3
- data/lib/basicjrpc/server.rb +3 -3
- data/lib/basicjrpc/version.rb +1 -1
- 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: 1a50bdaad064f8914e049227096b99a7b1f41774
|
4
|
+
data.tar.gz: 8d0e61b1444119727ddd447d26d63a1007d0cc4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968143d899be24449685637c604cff574b2e4f0e2f4f301dda63fdb885a1e3b64af9f4646e1fb4917a8b0e6b15dc6b0140bde40ad82ad23c5a883128c95637cc
|
7
|
+
data.tar.gz: f0bb45c4781d8bd8df359ec52d6d7b88c9d4ea8e6403f8e03ff8aee4b5aa5a5e600eec362471b73e9246229f51cd8820d1f740e2922121f8d2c96688942878ba
|
data/lib/basicjrpc/client.rb
CHANGED
@@ -10,13 +10,13 @@ module BasicJRPC
|
|
10
10
|
|
11
11
|
# Responding Client
|
12
12
|
class Client
|
13
|
-
def initialize(queue, timeout = 5)
|
13
|
+
def initialize(queue, timeout = 5, host="redis")
|
14
14
|
@queue = queue
|
15
15
|
@payload = {}
|
16
16
|
@timeout = timeout
|
17
17
|
@instance_id = SecureRandom.uuid
|
18
18
|
#@nsq_producer = Nsq::Producer.new(nsqd: 'dockerlb:4150', topic: @queue)
|
19
|
-
@redis = Redis.new(host:
|
19
|
+
@redis = Redis.new(host: host)
|
20
20
|
end
|
21
21
|
|
22
22
|
def method_missing(m, *args, &block)
|
@@ -30,7 +30,7 @@ module BasicJRPC
|
|
30
30
|
|
31
31
|
my_message = false
|
32
32
|
|
33
|
-
puts "Writing Message #{payload['message_id']} #{payload['method_name']}"
|
33
|
+
#puts "Writing Message #{payload['message_id']} #{payload['method_name']}"
|
34
34
|
#@nsq_producer.write(Oj.dump(payload))
|
35
35
|
@redis.rpush(@queue, Oj.dump(payload, mode: :compat))
|
36
36
|
|
data/lib/basicjrpc/server.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module BasicJRPC
|
2
2
|
class Server
|
3
3
|
|
4
|
-
def initialize queue, injected_class
|
4
|
+
def initialize queue, injected_class, host="redis"
|
5
5
|
@injected_class = injected_class
|
6
6
|
@queue = queue
|
7
7
|
#@nsq_consumer = Nsq::Consumer.new(nsqlookupd: 'dockerlb:4161', topic: @queue, channel: 'server')
|
8
|
-
@redis = Redis.new(host:
|
8
|
+
@redis = Redis.new(host: host)
|
9
9
|
end
|
10
10
|
|
11
11
|
def listen
|
@@ -18,7 +18,7 @@ module BasicJRPC
|
|
18
18
|
#message = @nsq_consumer.pop
|
19
19
|
|
20
20
|
payload = Oj.load(message, :symbol_keys => true)
|
21
|
-
puts "Processing message #{payload.message_id} #{payload.method_name} #{payload.method_arguments} #{payload.callers}"
|
21
|
+
#puts "Processing message #{payload.message_id} #{payload.method_name} #{payload.method_arguments} #{payload.callers}"
|
22
22
|
|
23
23
|
# Should always return a data object
|
24
24
|
response = @injected_class.send(payload.method_name, *payload.method_arguments)
|
data/lib/basicjrpc/version.rb
CHANGED