grpcsource

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 19 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 source that holds the given path.

func Register

func Register(path string) chan hermod.Message

Register creates the channel a gRPC source reads its path from. It holds the path if nothing else does, and otherwise waits to take it over.

func Unregister

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

Unregister releases a channel's claim on a path. Only the channel that holds the path removes it, so an outgoing engine's teardown cannot remove the source that took over from it.

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 is the store holding the sources' API keys, for a caller whose
	// store never changes.
	Storage storage.Storage

	// StorageFunc, when set, is asked for that store on every Publish and takes
	// precedence over Storage. The API server needs this: its store is nil
	// until first-time setup opens a database and is replaced again by a
	// database switch, and a copy taken when the listener started never saw
	// either — so a fresh install checked no keys at all until it was restarted.
	StorageFunc func() storage.Storage
}

Server implements the proto.SourceServiceServer interface.

func (*Server) Publish

func (*Server) PublishStream added in v1.17.0

PublishStream is Publish over one long-lived stream. Every record received is answered with one response under that record's id: "dispatched", or for a source that responds synchronously, what the workflow did with it.

A record that cannot be queued — nothing holds its path, or the source's buffer is full — is answered "rejected" and the stream stays open: neither is a reason to make a producer reconnect. A record its key does not cover ends the stream with the error, as it would end a call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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