Class: TaskServiceSubscribeClient
- Inherits:
-
Object
- Object
- TaskServiceSubscribeClient
- Defined in:
- lib/client/task_service_subscribe_client.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#stub ⇒ Object
Returns the value of attribute stub.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(address, auth) ⇒ TaskServiceSubscribeClient
constructor
A new instance of TaskServiceSubscribeClient.
- #marshal(obj) ⇒ Object
- #Send(streamMessage) ⇒ Object
- #test_a(bbb, streamMessage) ⇒ Object
- #test_send(streamMessage) ⇒ Object
- #unmarshal(str) ⇒ Object
Constructor Details
#initialize(address, auth) ⇒ TaskServiceSubscribeClient
Returns a new instance of TaskServiceSubscribeClient.
5 6 7 8 9 |
# File 'lib/client/task_service_subscribe_client.rb', line 5 def initialize(address,auth) @stub = GRPC::ClientStub.new(address,:this_channel_is_insecure) = {"authorization": auth} end |
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/client/task_service_subscribe_client.rb', line 3 def end |
#stub ⇒ Object
Returns the value of attribute stub.
2 3 4 |
# File 'lib/client/task_service_subscribe_client.rb', line 2 def stub @stub end |
Instance Method Details
#each ⇒ Object
40 41 42 |
# File 'lib/client/task_service_subscribe_client.rb', line 40 def each end |
#marshal(obj) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/client/task_service_subscribe_client.rb', line 16 def marshal(obj) # a = { # code: obj.code, # node_key: obj.node_key, # key: obj.key, # from: obj.from, # to: obj.to, # data: obj.data, # error: obj.error, # } # return a.to_json return Grpc::StreamMessage.encode(obj) end |
#Send(streamMessage) ⇒ Object
11 12 13 |
# File 'lib/client/task_service_subscribe_client.rb', line 11 def Send(streamMessage) @stub.client_streamer("/grpc.TaskService/Subscribe", streamMessage, method(:marshal), method(:unmarshal),metadata: ) end |
#test_a(bbb, streamMessage) ⇒ Object
48 49 50 51 |
# File 'lib/client/task_service_subscribe_client.rb', line 48 def test_a(bbb,streamMessage) a = bbb.call(streamMessage) puts a end |
#test_send(streamMessage) ⇒ Object
44 45 46 |
# File 'lib/client/task_service_subscribe_client.rb', line 44 def test_send(streamMessage) test_a(method(:marshal),streamMessage) end |
#unmarshal(str) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/client/task_service_subscribe_client.rb', line 31 def unmarshal(str) # a = JSON.parse(str) # obj = StreamMessage.new(a) # return obj return Grpc::StreamMessage.decode(obj) end |