Class: Grpc::Client::ORiN3::Provider::ORiN3Stream
- Inherits:
-
ORiN3BaseObject
- Object
- ORiN3BaseObject
- Grpc::Client::ORiN3::Provider::ORiN3Stream
- Includes:
- ORiN3ResourceOpener
- Defined in:
- lib/grpc/client/orin3/provider/orin3_stream.rb
Instance Attribute Summary collapse
-
#created_datetime ⇒ Object
readonly
Returns the value of attribute created_datetime.
Attributes inherited from ORiN3BaseObject
#name, #option, #orin3_object_type, #type_name
Instance Method Summary collapse
-
#initialize(channel, internal_id, created_datetime) ⇒ ORiN3Stream
constructor
A new instance of ORiN3Stream.
- #read ⇒ Object
Methods included from ORiN3ResourceOpener
Methods inherited from ORiN3BaseObject
#execute, #get_status, #get_tag, #get_tag_keys, #id, #remove_tag, #set_tag
Constructor Details
#initialize(channel, internal_id, created_datetime) ⇒ ORiN3Stream
Returns a new instance of ORiN3Stream.
22 23 24 25 |
# File 'lib/grpc/client/orin3/provider/orin3_stream.rb', line 22 def initialize(channel, internal_id, created_datetime) @created_datetime = created_datetime super(channel, internal_id) end |
Instance Attribute Details
#created_datetime ⇒ Object (readonly)
Returns the value of attribute created_datetime.
19 20 21 |
# File 'lib/grpc/client/orin3/provider/orin3_stream.rb', line 19 def created_datetime @created_datetime end |
Instance Method Details
#read ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/grpc/client/orin3/provider/orin3_stream.rb', line 27 def read begin stream = O3::StreamService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel) request = O3::ReadRequest.new(common: O3P::CommonRequest.new, id: @internal_id) responses = stream.read(request) responses.each do |response| if response.common.result_code != :SUCCEEDED raise "Read failed: #{response.common.detail}" end yield response.value if block_given? end rescue MessageClientError raise rescue StandardError => e raise MessageClientError.new(e) end end |