Gateway
You can write rpc http clients in any programming languages such as Java、Python、C#、Node.js、Php、C\C++、Rust and others. See examples for many languages.
That means, you can use another approach to access rpcx services instead of implementing protocol.
There are two deployment modes: Gateway and Agent。
You can deploy this as gateway model. Gateway is running at independent servers. Clients sends http requests to gateways, and gateways translate http requests into raw rpcx requests. And then gateways send raw rpcx requests to rpcx services.
You can scale gateway easily because it is stateless.
It works like a http load balancer.
Agent
You can also deploy this as agent model. Agents are deploy with clients. They are installed as a daemon application in node of clients. If there are multiple clients in one node, you only need to install one agent.
Clients send http requests to their local agent. The local agent translate http requests into rpcx requests, send rpcx requests to rpcx services, translate rpcx responses into http ressponses.
Protocol
You can send a http request in any programming languages. You must set some extra http headers in requests.
- X-RPCX-MesssageType: set 0 as request
- X-RPCX-Heartbeat: is heartbeat request or not, false in default.
- X-RPCX-Oneway: is one-way request or not, false in default.
- X-RPCX-SerializeType: 0 as raw bytes, 1 as JSON, 2 as protobuf, 3 as msgpack
- X-RPCX-MessageID: message ID, uint64 type
- X-RPCX-ServiceMethod: service method
X-RPCX-Meta: extra metadata
For the http response, there are some extra http headers:X-RPCX-Version: rpcx version
- X-RPCX-MesssageType: 1 as response
- X-RPCX-Heartbeat: is heartbeat response or not
- X-RPCX-SerializeType: 0 as raw bytes, 1 as JSON, 2 as protobuf, 3 as msgpack
- X-RPCX-MessageID: message ID, uint64 type
- X-RPCX-ServicePath: service path
- X-RPCX-ServiceMethod: service method
- X-RPCX-Meta: extra metadata
There is a golang http client example:
By smallnest updated 2018-03-27 11:12:10