Class: Thrift::Processor::BinaryProcessor

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

Direct Known Subclasses

BaseStreamProcessor

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of BinaryProcessor.



223
224
225
226
227
228
229
230
231
232
# File 'lib/thrift/processor.rb', line 223

def initialize(name, info, middleware, handler)
  @middleware = middleware
  @handler = handler
  @arg_keys = info[:args]
  @void_result = info[:void_result]
  @result_klass = info[:result_klass]
  @exceptions = info[:exceptions]

  super name, info[:args_klass]
end

Instance Method Details

#process(seqid, iprot, oprot) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/thrift/processor.rb', line 234

def process(seqid, iprot, oprot)
  res = @middleware.handle_binary(@name, read_args(iprot)) do |args|
    execute(args)
  end

  write_result(res, oprot, seqid)

  true
rescue ApplicationException => e
  Processor.write_exception(e, oprot, @name, seqid)
  true
rescue StandardError => e
  Processor.write_internal_error(e, oprot, @name, seqid)
  true
end