Class: Thrift::MultiplexedProcessor
- Inherits:
-
Object
- Object
- Thrift::MultiplexedProcessor
- Defined in:
- lib/thrift/multiplexed_processor.rb
Instance Method Summary collapse
-
#initialize ⇒ MultiplexedProcessor
constructor
A new instance of MultiplexedProcessor.
- #process(iprot, oprot) ⇒ Object
- #register_default(processor) ⇒ Object
- #register_processor(service_name, processor) ⇒ Object
Constructor Details
#initialize ⇒ MultiplexedProcessor
Returns a new instance of MultiplexedProcessor.
25 26 27 28 |
# File 'lib/thrift/multiplexed_processor.rb', line 25 def initialize @actual_processors = {} @default_processor = nil end |
Instance Method Details
#process(iprot, oprot) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/thrift/multiplexed_processor.rb', line 38 def process(iprot, oprot) name, type, seqid = iprot. check_type(type) if name.count(':') < 1 check_default_processor(name) return @default_processor.process(StoredMessageProtocol.new(iprot, [name, type, seqid]), oprot) end service_name, method = name.split(':', 2) processor(service_name).process(StoredMessageProtocol.new(iprot, [method, type, seqid]), oprot) end |
#register_default(processor) ⇒ Object
34 35 36 |
# File 'lib/thrift/multiplexed_processor.rb', line 34 def register_default(processor) @default_processor = processor end |
#register_processor(service_name, processor) ⇒ Object
30 31 32 |
# File 'lib/thrift/multiplexed_processor.rb', line 30 def register_processor(service_name, processor) @actual_processors[service_name] = processor end |