I am trying to correctly model a container queue_object using protobufs. It wraps ‘args’ message object and acts as the container for ‘eventing_template’ message object.
Finally, ‘Data’ message object is extended by ‘admin’ and ‘analytics’ message object.
Couple of things I am head heavy with right now :
First, is this the best way to model this scenario ? I have my sample files below.
Second, I get an attributeerror exception saying the attr is readonly when trying to write eventing_template message’s attr ‘appname’.
"AttributeError: 'event_template' object attribute 'appname' is read-only"
Not sure what is the correct way to write/read eventing.appname and similar indirect references. I am writing the client in python.
filename : queue_object.proto
message queue_object {
required string kwargs = 1;
message args {
extensions 100 to 200;
}
required string errors = 3;
required string trace_id = 4;
required string start_time = 5;
}
filename : eventing_template.proto
import "queue_object.proto";
message event_template {
message Data {
extensions 1000 to max;
}
extend queue_object.args {
required string appname = 101;
optional int32 completion_status = 102;
optional int32 page_number = 103;
optional int32 result_per_page = 104;
optional User user = 112;
optional Data data = 116;
}
}
message User {
optional string ip = 1;
optional string xid = 2;
optional string loc = 3;
optional string aid = 4;
}
filename : admin.proto
import "event_template.proto";
message admin {
extend event_template.Data {
optional string content_length = 1000;
optional string oauth_app_id = 1001;
optional string response_code = 1002;
optional int64 response_length = 1003;
optional bool static = 1004;
}
}
filename : analytics.proto
import "event_template.proto";
message analytics {
extend event_template.Data {
optional string content_length = 2000;
optional string oauth_app_id = 2001;
optional string response_code = 2002;
optional int64 response_length = 2003;
optional bool static = 2004;
}
}
Would really appreciate feedback on this
Thanks,
Aditya