func RunServer(srv rpc.Server, handler TestServiceServer) {
	srv.Serve(func(funcID int32, arg []byte) ([]byte, error) {
		switch funcID {
		case Functions_Ping:
			return _Handle_Ping(handler, arg)
		case Functions_CreateUser:
			return _Handle_CreateUser(handler, arg)
		case Functions_CreateAccount:
			return _Handle_CreateAccount(handler, arg)
		case Functions_FindAccount:
			return _Handle_FindAccount(handler, arg)
		default:
			return nil, errors.New(fmt.Sprintf("unknown function with code: %d", funcID))
		}
	})
}
Run server API with this call
package main
import fmt "fmt"
import errors "errors"
import rpc "github.com/gavrilaf/amqp/rpc"
import proto "github.com/gogo/protobuf/proto"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type TestServiceServer interface {
	Ping(arg *Empty) (*ServerStatus, error)
	CreateUser(arg *User) (*ResourceID, error)
	CreateAccount(arg *Account) (*ResourceID, error)
	FindAccount(arg *ResourceID) (*Account, error)
}