Hi all,
I was hoping for some advice for designing my publish subscribe system on top of protobuf and rpc.
The idea is that a developer may have defined set of messages, a normal service and some rpc methods which they then augment with some publishers and subscribers.
For example, given this ordinary service..
syntax = "proto3";
package helloworld;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
I'm thinking of creating my own extensions and options so a developer can describe which messages it publishes and what messages it subscribes to but I'm struggling with how to implement it, here's a proposal of a annotated proto
syntax = "proto3";
package helloworld;
enum Broadcasts {
HELLO = 0;
}
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
option (subscribers) = {
publisher {
name: HELLO
returns: HelloReply
}
subscriber {
name: HELLO
}
subscriber {
name: some_service.CREATED
}
};
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
The problem is in defining the .proto for the subscribers option, how do I create a message/extention which accepts an ENUM or Message type as a value to be set.
I'm also open to completely different ways of designing this, but I was hoping to have a way to define subscribers and publishers in a typed way that shows me the dependencies so I can then generate the code.
Any help would be appreciated! Thanks