关于jsonrpc的使用问题
gitwanzx opened this issue · 6 comments
gitwanzx commented
您好,我想请教一下,关于在micro中基于consul使用jsonrpc去调用服务是怎么操作的,我知道go里面自带了jsonrpc的包,但是我该怎样使用consul去实现此功能呢?
printfcoder commented
Hi,不需要。Micro中的rpc默认使用的就是jsonrpc,只是是micro自己实现的一个编码器。golang原生的jsonrpc我没有用过,不能给您想要的答复。
不过基于Micro体系而言,我觉得是不需要去引用其它rpc框架的东西的,Micro有自己的协议风格, 自成体系。不知道有没有使用过完整的Micro功能?如果没有建议了解下,如果有确实是不需要再关注第三方的rpc框架了,用micro即可。
gitwanzx commented
您好,我是最近才开始使用micro的,之前都是使用gRpc的,最近想试一下jsonrpc,但是因为实在找不到关于micro框架使用jsonrpc的例子,不知道您可不可以给个例子让我参考一下,谢谢!
printfcoder commented
是不存在这样的例子的,首先,咱们得这么说:golang自己的Jsonrpc可以理解为是grpc同级别的一种rpc库,只是它很轻量。同样,与grpc是无关的,与micro也是无关的。
如果想用jsonrpc,那就用golang官方教程去实现即可。不需要走micro这个壳把它包装起来,因为确实没有什么用。
gitwanzx commented
@printfcoder 您好,感谢您的回复,现在我用JSON客户端可以实现jsonrpc的调用了。但是我还有个问题想请教一下,就是有些框架使用jsonrpc时规定消息协议要以"\r\n"结尾,我要怎样设置才能以这个为结尾去请求这些框架的服务呢。
printfcoder commented
不好意思,我不擅长这个框架
gitwanzx commented
没关系,很感谢您能在百忙之中回复我的问题
…------------------ 原始邮件 ------------------
发件人: "Shu xian"<notifications@github.com>;
发送时间: 2019年10月15日(星期二) 晚上8:08
收件人: "micro-in-cn/tutorials"<tutorials@noreply.github.com>;
抄送: "屎前巨饿"<1774529992@qq.com>; "Author"<author@noreply.github.com>;
主题: Re: [micro-in-cn/tutorials] 关于jsonrpc的使用问题 (#149)
不好意思,我不擅长这个框架
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.