Class: Thrift::MultiplexedProcessor
- Inherits:
-
Object
- Object
- Thrift::MultiplexedProcessor
- Defined in:
- lib/thrift_client/thrift/processor.rb
Instance Method Summary collapse
-
#initialize ⇒ MultiplexedProcessor
constructor
A new instance of MultiplexedProcessor.
- #process(iprot, oprot) ⇒ Object
- #register(service_name, processor) ⇒ Object
Constructor Details
#initialize ⇒ MultiplexedProcessor
Returns a new instance of MultiplexedProcessor.
16 17 18 |
# File 'lib/thrift_client/thrift/processor.rb', line 16 def initialize @actual_processors = Hash.new end |
Instance Method Details
#process(iprot, oprot) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/thrift_client/thrift/processor.rb', line 25 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_name, processor) ⇒ Object
20 21 22 23 |
# File 'lib/thrift_client/thrift/processor.rb', line 20 def register(service_name, processor) processor.instance_variable_set(:@service_name, service_name) @actual_processors[service_name] = processor end |