Documentation ¶
Index ¶
Constants ¶
View Source
const ( XVersion = "X-RPCX-Version" XMessageType = "X-RPCX-MesssageType" XHeartbeat = "X-RPCX-Heartbeat" XOneway = "X-RPCX-Oneway" XMessageStatusType = "X-RPCX-MessageStatusType" XSerializeType = "X-RPCX-SerializeType" XMessageID = "X-RPCX-MessageID" XServicePath = "X-RPCX-ServicePath" XServiceMethod = "X-RPCX-ServiceMethod" XMeta = "X-RPCX-Meta" XErrorMessage = "X-RPCX-ErrorMessage" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gateway ¶
type Gateway struct { FailMode client.FailMode SelectMode client.SelectMode Option client.Option // contains filtered or unexported fields }
Gateway is a rpcx gateway which can convert http invoke into rpcx invoke.
func NewGateway ¶
func NewGateway(base string, hs HTTPServer, sd client.ServiceDiscovery, failMode client.FailMode, selectMode client.SelectMode, option client.Option) *Gateway
NewGateway returns a new gateway.
type HTTPServer ¶
type HTTPServer interface { RegisterHandler(base string, handler ServiceHandler) Serve() error }
HTTPServer is a golang web interface。 You can use echo, gin, iris or other go web frameworks to implement it. You must wrap ServiceHandler into your handler of your selected web framework and add it into router.
type ServiceHandler ¶
ServiceHandler converts http.Request into rpcx.Request and send it to rpcx service, and then converts the result and writes it into http.Response. You should get the http.Request and servicePath in your web handler.
Click to show internal directories.
Click to hide internal directories.