-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ add grpc option for cloudevents client. #302
✨ add grpc option for cloudevents client. #302
Conversation
e71019b
to
69ae49a
Compare
69ae49a
to
95fdc0a
Compare
Signed-off-by: morvencao <lcao@redhat.com>
95fdc0a
to
1672cbe
Compare
Signed-off-by: morvencao <lcao@redhat.com>
06fad7a
to
22d3898
Compare
Signed-off-by: morvencao <lcao@redhat.com>
22d3898
to
55c9f2c
Compare
return &GRPCOptions{} | ||
} | ||
|
||
func (o *GRPCOptions) AddFlags(flags *pflag.FlagSet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also be in the config similar as mqtt. It will be better it we share the same config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the grpc options to use config similar to mqtt.
Signed-off-by: morvencao <lcao@redhat.com>
|
||
package io.cloudevents.v1; | ||
|
||
option go_package = "open-cluster-management.io/api/cloudevents/generic/options/grpc/protobuf/v1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is needed if the protobuf message is changed? We need some readme to explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a readme file and some comments to guide developer how to update go code after modifying the proto file.
Signed-off-by: morvencao <lcao@redhat.com>
"open-cluster-management.io/api/cloudevents/generic/options/grpc/protocol" | ||
) | ||
|
||
const ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these topics to a common file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the topic structure for gRPC aligns with MQTT, but when we have a third option like Kafka, that would need a distinct pattern for topics. In that case, a common file for topics becomes unfeasible, make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but I think the ideal situation is to have unified topics :), we can keep the topics in each option firstly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's organize topics within each option for now and and see if we can have a unified topics in the future.
} | ||
|
||
func (o *grpcAgentOptions) WithContext(ctx context.Context, evtCtx cloudevents.EventContext) (context.Context, error) { | ||
eventType, err := types.ParseCloudEventsType(evtCtx.GetType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this for grpc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We require this information to assign the topic for event publish, and the topic will be included in the gRPC publish request, see:
api/cloudevents/generic/options/grpc/protobuf/v1/cloudevent.proto
Lines 68 to 73 in 3012fe5
message PublishRequest { | |
// Required. The topic to which event should be published. | |
// Format is `myhome/groundfloor/livingroom/temperature`. | |
string topic = 1; | |
CloudEvent event = 2; | |
} |
@@ -0,0 +1,30 @@ | |||
# CloudEvent gRPC Protobuf Definitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you also link this in the https://github.com/open-cluster-management-io/api/blob/main/cloudevents/README.md, we have a client introduction in this doc, you can add a new option in the CloudEventsOptions, it provides ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added grpc option to cloudevents/README.md
Signed-off-by: morvencao <lcao@redhat.com>
94415ee
to
1bc3d90
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: morvencao, qiujian16 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
a2f58d6
into
open-cluster-management-io:main
Summary
This PR tries to add gRPC option for cloudevents client.
Related issue(s)
Fixes #