type BarServiceProcessor struct { *FooServiceProcessor handler BarService } func (p *BarServiceProcessor) GetProcessorFunction(key string) (processor func(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException), ok bool) { switch key { case "ping": return p.Process_Ping, true default: return p.FooServiceProcessor.GetProcessorFunction(key) } } func NewBarServiceProcessor(handler BarService) *BarServiceProcessor { return &BarServiceProcessor{NewFooServiceProcessor(handler), handler} } func (p *BarServiceProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { name, _, seqId, err := iprot.ReadMessageBegin() if err != nil { return false, err } if processor, ok := p.GetProcessorFunction(name); ok { return processor(seqId, iprot, oprot) } iprot.Skip(thrift.STRUCT) iprot.ReadMessageEnd() x8 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) x8.Write(oprot) oprot.WriteMessageEnd() oprot.Flush() return false, x8 } func (p *BarServiceProcessor) Process_Ping(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { //... }