[英]How to filter in PUB/SUB ( ZeroMQ ) with protobuf binaries?
我使用 Go、ZeroMQ 和 protobuf 来编写微服务。
带有PUB/SUB
原型的 ZeroMQ。 ( Go 中的zmq4
库)。 如何在带有二进制 protobuf 消息的SUB
消息中使用过滤器?
例如我的原始消息:
语法 = "proto3";
message UserMessage {
string userId = 1;
string msg = 2;
}
我想过滤具有userId
值的SUB
客户端的消息:
listener.SetSubscribe("42") // <-string not working.
我知道了:
listener.SetSubscribe( string( []byte{ 10, 2 } ) + "42" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.