Skip to content

gRPC protocol implementation #980

Open
@morvencao

Description

@morvencao

The cloudevents sdk-go currently offers support for various protocol implementations, except for gRPC.
It is essential to add gRPC protocol support since it is widely used.

While the cloudevent proto is presented in the repository, it lacks the RPC service definition necessary for implementing the gRPC protocol in cloud event sdk-go.

To enable gRPC functionality, defining the RPC service and method is imperative. This ensures cloudevents sdk-go to send and receive through the generated golang gRPC client.

Can we incorporate the RPC service and method into the cloudevent proto in the following manner:

image

Next, utilize protoc to generate the RPC client and server code, which can be employed to implement the gRPC protocol as follows:

# cat protocol/grpc/protocol.go
...
// protocol for grpc
// define protocol for grpc

type Protocol struct {
	client          pb.CloudEventServiceClient
	publishOption   *PublishOption
	subscribeOption *SubscribeOption
	// receiver
	incoming chan *pb.CloudEvent
	// inOpen
	openerMutex sync.Mutex

	closeChan chan struct{}
}
...

/cc @embano1 @yanmxa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions