Documentation ¶
Index ¶
- func NewService(address string) (s common.Service, err error)
- func NewServiceWithGrpcServer(lis net.Listener, server *grpc.Server) common.Service
- func NewServiceWithListener(lis net.Listener, opts ...grpc.ServerOption) common.Service
- type Server
- func (s *Server) AddBindingInvocationHandler(name string, fn common.BindingInvocationHandler) error
- func (s *Server) AddHealthCheckHandler(_ string, fn common.HealthCheckHandler) error
- func (s *Server) AddServiceInvocationHandler(method string, fn cc.ServiceInvocationHandler) error
- func (s *Server) AddTopicEventHandler(sub *common.Subscription, fn common.TopicEventHandler) error
- func (s *Server) GracefulStop() error
- func (s *Server) GrpcServer() *grpc.Server
- func (s *Server) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*pb.HealthCheckResponse, error)
- func (s *Server) ListInputBindings(ctx context.Context, in *emptypb.Empty) (*pb.ListInputBindingsResponse, error)
- func (s *Server) ListTopicSubscriptions(ctx context.Context, in *emptypb.Empty) (*runtimev1pb.ListTopicSubscriptionsResponse, error)
- func (s *Server) OnBindingEvent(ctx context.Context, in *pb.BindingEventRequest) (*pb.BindingEventResponse, error)
- func (s *Server) OnInvoke(ctx context.Context, in *cpb.InvokeRequest) (*cpb.InvokeResponse, error)
- func (s *Server) OnTopicEvent(ctx context.Context, in *runtimev1pb.TopicEventRequest) (*runtimev1pb.TopicEventResponse, error)
- func (s *Server) RegisterActorImplFactory(f actor.Factory, opts ...config.Option)deprecated
- func (s *Server) RegisterActorImplFactoryContext(f actor.FactoryContext, opts ...config.Option)
- func (s *Server) Start() error
- func (s *Server) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
NewService creates new Service.
func NewServiceWithGrpcServer ¶
NewServiceWithGrpcServer creates a new Service with specific listener and grpcServer
func NewServiceWithListener ¶
NewServiceWithListener creates new Service with specific listener.
Types ¶
type Server ¶
type Server struct { pb.UnimplementedAppCallbackServer pb.UnimplementedAppCallbackHealthCheckServer // contains filtered or unexported fields }
Server is the gRPC service implementation for Dapr.
func (*Server) AddBindingInvocationHandler ¶
func (s *Server) AddBindingInvocationHandler(name string, fn common.BindingInvocationHandler) error
AddBindingInvocationHandler appends provided binding invocation handler with its name to the service.
func (*Server) AddHealthCheckHandler ¶
func (s *Server) AddHealthCheckHandler(_ string, fn common.HealthCheckHandler) error
AddHealthCheckHandler appends provided app health check handler.
func (*Server) AddServiceInvocationHandler ¶
func (s *Server) AddServiceInvocationHandler(method string, fn cc.ServiceInvocationHandler) error
AddServiceInvocationHandler appends provided service invocation handler with its method to the service.
func (*Server) AddTopicEventHandler ¶
func (s *Server) AddTopicEventHandler(sub *common.Subscription, fn common.TopicEventHandler) error
AddTopicEventHandler appends provided event handler with topic name to the service.
func (*Server) GracefulStop ¶
GrecefulStop stops the previously-started service gracefully.
func (*Server) GrpcServer ¶
GrpcServer returns the grpc.Server object managed by the server.
func (*Server) HealthCheck ¶
func (s *Server) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*pb.HealthCheckResponse, error)
HealthCheck check app health status.
func (*Server) ListInputBindings ¶
func (s *Server) ListInputBindings(ctx context.Context, in *emptypb.Empty) (*pb.ListInputBindingsResponse, error)
ListInputBindings is called by Dapr to get the list of bindings the app will get invoked by. In this example, we are telling Dapr To invoke our app with a binding named storage.
func (*Server) ListTopicSubscriptions ¶
func (s *Server) ListTopicSubscriptions(ctx context.Context, in *emptypb.Empty) (*runtimev1pb.ListTopicSubscriptionsResponse, error)
ListTopicSubscriptions is called by Dapr to get the list of topics in a pubsub component the app wants to subscribe to.
func (*Server) OnBindingEvent ¶
func (s *Server) OnBindingEvent(ctx context.Context, in *pb.BindingEventRequest) (*pb.BindingEventResponse, error)
OnBindingEvent gets invoked every time a new event is fired from a registered binding. The message carries the binding name, a payload and optional metadata.
func (*Server) OnInvoke ¶
func (s *Server) OnInvoke(ctx context.Context, in *cpb.InvokeRequest) (*cpb.InvokeResponse, error)
OnInvoke gets invoked when a remote service has called the app through Dapr.
func (*Server) OnTopicEvent ¶
func (s *Server) OnTopicEvent(ctx context.Context, in *runtimev1pb.TopicEventRequest) (*runtimev1pb.TopicEventResponse, error)
OnTopicEvent fired whenever a message has been published to a topic that has been subscribed. Dapr sends published messages in a CloudEvents v1.0 envelope.
func (*Server) RegisterActorImplFactoryContext ¶
func (s *Server) RegisterActorImplFactoryContext(f actor.FactoryContext, opts ...config.Option)