Class: Thrift::MultiplexedProcessor
- Inherits:
-
Object
- Object
- Thrift::MultiplexedProcessor
- Defined in:
- lib/thrift_client/thrift.rb,
lib/thrift_client/multiplexed_processor.rb
Instance Method Summary collapse
-
#initialize ⇒ MultiplexedProcessor
constructor
A new instance of MultiplexedProcessor.
- #process(iprot, oprot) ⇒ Object
- #register(service, processor) ⇒ Object
Constructor Details
#initialize ⇒ MultiplexedProcessor
31 32 33 |
# File 'lib/thrift_client/thrift.rb', line 31 def initialize @actual_processors = Hash.new end |
Instance Method Details
#process(iprot, oprot) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/thrift_client/thrift.rb', line 40 def process(iprot, oprot) name, type, seqid = iprot. service_name, method = name.split(':') actual_processor = @actual_processors[service_name] if actual_processor.respond_to?("process_#{method}") actual_processor.send("process_#{method}", seqid, iprot, oprot) true else iprot.skip(Types::STRUCT) iprot. x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function ' + name) oprot.(name, MessageTypes::EXCEPTION, seqid) x.write(oprot) oprot. oprot.trans.flush false end end |
#register(service, processor) ⇒ Object
35 36 37 38 |
# File 'lib/thrift_client/thrift.rb', line 35 def register(service_name, processor) processor.instance_variable_set(:@service_name, service_name) @actual_processors[service_name] = processor end |