Class: Thrift::Processor::InboundStreamProcessor

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InboundStreamProcessor.



332
333
334
335
336
# File 'lib/thrift/processor.rb', line 332

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

  super name, info, middleware, handler
end

Instance Method Details

#process(seqid, iprot, oprot) ⇒ Object



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/thrift/processor.rb', line 338

def process(seqid, iprot, oprot)
  @closed = false
  stream = TInboundStream.new(
    iprot, oprot, @name, seqid, @sink_klass,
    MessageTypes::CLIENT_STREAM_MESSAGE,
    method(:close)
  )

  res = @middleware.handle_inbound_stream(
    @name, read_args(iprot), stream
  ) { |args, sink| execute(args, sink) }


  write_result(res, oprot, seqid)
  stream.ready

  wait

  true
end