Documentation ¶
Index ¶
- Variables
- func NewGrpcServer(server *Server) *grpc.Server
- type Broker
- type GrpcServer
- func (gRPC *GrpcServer) CreateChannel(ctx context.Context, req *broker.CreateChannelRequest) (*broker.CreateChannelResponse, error)
- func (gRPC *GrpcServer) Publish(ctx context.Context, req *broker.PublishRequest) (*broker.PublishResponse, error)
- func (gRPC *GrpcServer) Subscribe(req *broker.SubscribeRequest, stream broker.BrokerService_SubscribeServer) error
- type Server
- func (s *Server) CreateChannel(ctx context.Context, req *broker.CreateChannelRequest) (*broker.CreateChannelResponse, error)
- func (s *Server) Publish(ctx context.Context, req *broker.PublishRequest) (*broker.PublishResponse, error)
- func (s *Server) Subscribe(req *broker.SubscribeRequest, stream broker.BrokerService_SubscribeServer) error
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFailedToSaveMessage is returned when the broker fails to save a message ErrFailedToSaveMessage = errors.New("error: failed to save message") // ErrChannelDoesNotExist is returned when the broker tries to publish a message to a non-existent channel ErrChannelDoesNotExist = errors.New("error: channel does not exist") // ErrChannelAlreadyExists is returned when the broker tries to create a channel that already exists ErrChannelAlreadyExists = errors.New("error: channel already exists") // ErrSubscriberDoesNotExist is returned when the broker tries to unsubscribe a subscriber from a channel in which the subscriber does not exist ErrSubscriberDoesNotExist = errors.New("error: subscriber is not subscribed to the channel") )
Functions ¶
func NewGrpcServer ¶
NewGrpcServer returns a new gRPC server
Types ¶
type Broker ¶
type Broker interface {
// contains filtered or unexported methods
}
Broker defines the interface for the message broker
type GrpcServer ¶
type GrpcServer struct { broker.UnimplementedBrokerServiceServer // contains filtered or unexported fields }
GrpcServer is the gRPC server
func (*GrpcServer) CreateChannel ¶
func (gRPC *GrpcServer) CreateChannel(ctx context.Context, req *broker.CreateChannelRequest) (*broker.CreateChannelResponse, error)
CreateChannel gRPC endpoint
func (*GrpcServer) Publish ¶
func (gRPC *GrpcServer) Publish(ctx context.Context, req *broker.PublishRequest) (*broker.PublishResponse, error)
Publish gRPC endpoint
func (*GrpcServer) Subscribe ¶
func (gRPC *GrpcServer) Subscribe(req *broker.SubscribeRequest, stream broker.BrokerService_SubscribeServer) error
Subscribe gRPC endpoint
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the broker service implementation for gRPC
func (*Server) CreateChannel ¶
func (s *Server) CreateChannel(ctx context.Context, req *broker.CreateChannelRequest) (*broker.CreateChannelResponse, error)
gRPC implementation of the CreateChannel method
func (*Server) Publish ¶
func (s *Server) Publish(ctx context.Context, req *broker.PublishRequest) (*broker.PublishResponse, error)
gRPC implementation of the Publish method
func (*Server) Subscribe ¶
func (s *Server) Subscribe(req *broker.SubscribeRequest, stream broker.BrokerService_SubscribeServer) error
gRPC implementation of the Subscribe method
Click to show internal directories.
Click to hide internal directories.