ergonats

package module
v0.0.0-...-00d538d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

Ergonats

Ergonats is a set of server processes and miscellaneous tools that make it easy to build ergo-based NATS applications.

Ergo provides an Erlang/OTP-style supervision hierarchy to Go applications. It's even binary-compatible with existing Erlang/Elixir clusters over the network. If you find yourself constantly creating goroutines that have an infinite for loop which in turn has a select in it, then you're already in a place where you can realize the benefit of Ergo.

To get a good idea for the inspiration behind Ergo, you might want to read Elixir's GenServer documentation, or you can read the Erlang documentation on OTP.

Ergonats contains some general purpose NATS-related servers like the PullConsumer as well as a complete event sourcing library built on top of Ergo.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJetStream

func GetJetStream(process *PullConsumerProcess) (jetstream.JetStream, error)

Types

type PullConsumer

type PullConsumer struct {
	gen.Server
}

func (*PullConsumer) HandleCall

func (c *PullConsumer) HandleCall(
	process *gen.ServerProcess,
	from gen.ServerFrom,
	message etf.Term) (etf.Term, gen.ServerStatus)

func (*PullConsumer) HandleCast

func (c *PullConsumer) HandleCast(
	process *gen.ServerProcess,
	message etf.Term) gen.ServerStatus

func (*PullConsumer) HandleDirect

func (c *PullConsumer) HandleDirect(
	process *gen.ServerProcess,
	ref etf.Ref, message interface{}) (interface{}, gen.DirectStatus)

func (*PullConsumer) HandleInfo

func (c *PullConsumer) HandleInfo(
	process *gen.ServerProcess,
	message etf.Term) gen.ServerStatus

func (*PullConsumer) Init

func (c *PullConsumer) Init(
	process *gen.ServerProcess,
	args ...etf.Term) error

func (*PullConsumer) Terminate

func (c *PullConsumer) Terminate(
	process *gen.ServerProcess,
	reason string)

type PullConsumerBehavior

type PullConsumerBehavior interface {
	gen.ServerBehavior

	InitPullConsumer(process *PullConsumerProcess, args ...etf.Term) (*PullConsumerOptions, error)
	HandleMessage(process *PullConsumerProcess, msg jetstream.Msg) error
}

type PullConsumerOptions

type PullConsumerOptions struct {
	Logger             *slog.Logger
	Connection         *nats.Conn
	JsDomain           string
	StreamName         string
	NatsConsumerConfig jetstream.ConsumerConfig
}

type PullConsumerProcess

type PullConsumerProcess struct {
	gen.ServerProcess
	// contains filtered or unexported fields
}

func (*PullConsumerProcess) Options

func (pcp *PullConsumerProcess) Options() *PullConsumerOptions

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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