Class: Thrift::Processor::OutboundStreamProcessor

Inherits:
BaseStreamProcessor show all
Defined in:
lib/thrift/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, info, middleware, handler) ⇒ OutboundStreamProcessor

Returns a new instance of OutboundStreamProcessor.



305
306
307
308
309
# File 'lib/thrift/processor.rb', line 305

def initialize(name, info, middleware, handler)
  @stream_klass = info[:stream_klass]

  super name, info, middleware, handler
end

Instance Method Details

#process(seqid, iprot, oprot) ⇒ Object



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/thrift/processor.rb', line 311

def process(seqid, iprot, oprot)
  @closed = false
  stream = TOutboundStream.new(
    iprot, oprot, @name, seqid, @stream_klass,
    MessageTypes::SERVER_STREAM_MESSAGE,
    method(:close)
  )
  res = @middleware.handle_outbound_stream(
    @name, read_args(iprot), stream
  ) { |args, stream| execute(args, stream) }

  write_result(res, oprot, seqid)
  stream.ready

  wait

  true
end