grpcsource

package
v1.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(path string, msg hermod.Message) error

Dispatch sends a message to the channel registered for the given path.

func Register

func Register(path string) chan hermod.Message

Register creates a new channel for a gRPC source path, superseding any existing registration. The newest registration owns the path: when a workflow moves between workers, the one taking the lease over is the one that should receive.

It used to return the existing channel instead, which meant the worker taking over and the worker being replaced read from the same one — so the outgoing teardown closed the channel its successor was reading.

func Unregister

func Unregister(path string, ch chan hermod.Message)

Unregister releases a path, but only if ch is still the channel registered for it.

The ownership check is what makes a handover safe. Nothing orders the outgoing worker's teardown against the incoming worker's registration, so deleting by path alone let a worker that had already lost the lease close and remove its successor's channel. The successor was then reading from a closed channel that no longer appeared in the registry: the workflow reported itself running and never received another message.

Types

type GenericProtoSource

type GenericProtoSource struct {
	ProtoFile   string
	MessageName string
	Source      hermod.Source
	// contains filtered or unexported fields
}

GenericProtoSource wraps another source and decodes its payload using dynamic Protobuf descriptors.

func NewGenericProtoSource

func NewGenericProtoSource(protoFile, messageName string, source hermod.Source) (*GenericProtoSource, error)

NewGenericProtoSource creates a new GenericProtoSource.

func (*GenericProtoSource) Ack

func (*GenericProtoSource) Close

func (s *GenericProtoSource) Close() error

func (*GenericProtoSource) Ping

func (s *GenericProtoSource) Ping(ctx context.Context) error

func (*GenericProtoSource) Read

type GrpcSource

type GrpcSource struct {
	Path string
	// contains filtered or unexported fields
}

GrpcSource implements the hermod.Source interface for receiving gRPC calls.

func NewGrpcSource

func NewGrpcSource(path string) *GrpcSource

NewGrpcSource creates a new GrpcSource.

func (*GrpcSource) Ack

func (s *GrpcSource) Ack(ctx context.Context, msg hermod.Message) error

func (*GrpcSource) Close

func (s *GrpcSource) Close() error

func (*GrpcSource) Ping

func (s *GrpcSource) Ping(ctx context.Context) error

func (*GrpcSource) Read

func (s *GrpcSource) Read(ctx context.Context) (hermod.Message, error)

type Server

type Server struct {
	proto.UnimplementedSourceServiceServer
	Storage storage.Storage
}

Server implements the proto.SourceServiceServer interface.

func (*Server) Publish

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL