Skip to content
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

Publish Protobuf definitions to Buf Schema Registry #863

Merged
merged 3 commits into from
Jul 28, 2024
Merged

Publish Protobuf definitions to Buf Schema Registry #863

merged 3 commits into from
Jul 28, 2024

Conversation

FZambia
Copy link
Member

@FZambia FZambia commented Jul 19, 2024

Proposed changes

Relates #851

With this change Centrifugo will publish its Protobuf definitions to Buf Schema Registry (BSR) on every release. Publishing:

It's important to mention that this all helps only with GRPC communication. Centrifugo APIs are not compatible with Buf connect's HTTP – we have our custom HTTP implementaion which re-uses Protobuf definitions for requests but still differs from Buf's connect framework. The differences may be eliminated probably, though requires a separate research – the hardest part is that for HTTP we use custom Raw type which is like a json.RawMessage under the hood and allows passing JSON objects without any wrapping.

Example for Go

package main

import (
	"context"
	"fmt"
	"log"

	apigrpc "buf.build/gen/go/centrifugo/apiproto/grpc/go/_gogrpc"
	apiproto "buf.build/gen/go/centrifugo/apiproto/protocolbuffers/go"
	"google.golang.org/grpc"
)

func main() {
	conn, err := grpc.NewClient("localhost:10000")
	if err != nil {
		log.Fatalln(err)
	}
	defer func() { _ = conn.Close() }()

	client := apigrpc.NewCentrifugoApiClient(conn)
	res, err := client.Publish(
		context.Background(),
		&apiproto.PublishRequest{
}
@FZambia FZambia merged commit 044eaff into master Jul 28, 2024
4 checks passed
@FZambia FZambia deleted the bsr branch July 28, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant