\ThriftTMultiplexedProcessor

<code>TMultiplexedProcessor</code> is a Processor allowing a single <code>TServer</code> to provide multiple services.

To do so, you instantiate the processor and then register additional processors with it, as shown in the following example:

$processor = new TMultiplexedProcessor(); processor->registerProcessor( "Calculator", new \tutorial\CalculatorProcessor(new CalculatorHandler())); processor->registerProcessor( "WeatherReport", new \tutorial\WeatherReportProcessor(new WeatherReportHandler())); $processor->process($protocol, $protocol);

Summary

Methods
Properties
Constants
registerProcessor()
process()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$serviceProcessorMap_
N/A

Properties

$serviceProcessorMap_

$serviceProcessorMap_ : 

Type

Methods

registerProcessor()

registerProcessor(  $serviceName,   $processor) 

'Register' a service with this <code>TMultiplexedProcessor</code>. This allows us to broker requests to individual services by using the service name to select them at request time.

Parameters

$serviceName
$processor

process()

process(\Thrift\Protocol\TProtocol  $input, \Thrift\Protocol\TProtocol  $output) 

This implementation of <code>process</code> performs the following steps:

  1. Read the beginning of the message.
  2. Extract the service name from the message.
  3. Using the service name to locate the appropriate processor.
  4. Dispatch to the processor, with a decorated instance of TProtocol that allows readMessageBegin() to return the original Message.

Parameters

\Thrift\Protocol\TProtocol $input
\Thrift\Protocol\TProtocol $output

Throws

\Thrift\Exception\TException

If the message type is not CALL or ONEWAY, if the service name was not found in the message, or if the service name was not found in the service map.