service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package service provides a wrapper around NATS for microservices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TinyService

type TinyService struct {

	// Config is the configuration for the NatsMicro instance.
	micro.Config
	// contains filtered or unexported fields
}

func NewTinyService

func NewTinyService(opts ...TinyServiceOption) (*TinyService, error)

NewTinyService creates a new NatsMicro instance with the given NATS connection and configuration.

func (*TinyService) AddEndpoint

func (nm *TinyService) AddEndpoint(name string, handler micro.Handler, opts ...micro.EndpointOpt) error

func (*TinyService) ConfigStore added in v0.2.0

func (nm *TinyService) ConfigStore() (jetstream.KeyValue, error)

func (*TinyService) CreateConfig added in v0.2.0

func (nm *TinyService) CreateConfig() error

func (*TinyService) Init

func (nm *TinyService) Init() error

func (*TinyService) RunBlocking

func (nm *TinyService) RunBlocking() error

func (*TinyService) Stop

func (nm *TinyService) Stop()

type TinyServiceOption

type TinyServiceOption func(*TinyService)

TinyServiceOption is a function that configures the NatsMicro instance.

func WithDescription

func WithDescription(description string) TinyServiceOption

WithDescription sets the description for the NatsMicro instance.

func WithDoneHandler

func WithDoneHandler(handler micro.DoneHandler) TinyServiceOption

WithDoneHandler sets the done handler for the NatsMicro instance.

func WithEndpoint

func WithEndpoint(endpoint *micro.EndpointConfig) TinyServiceOption

WithEndpoint sets the endpoint for the NatsMicro instance.

func WithErrorHandler

func WithErrorHandler(handler micro.ErrHandler) TinyServiceOption

WithErrorHandler sets the error handler for the NatsMicro instance.

func WithGroup

func WithGroup(groupName string) TinyServiceOption

WithGroup sets the group name for the NatsMicro instance.

func WithName

func WithName(name string) TinyServiceOption

WithName sets the name for the NatsMicro instance.

func WithNatsConn

func WithNatsConn(nc *nats.Conn) TinyServiceOption

WithNatsConn sets the NATS connection for the NatsMicro instance.

func WithNatsOptions

func WithNatsOptions(opts ...nats.Option) TinyServiceOption

WithNatsOptions sets the NATS options for the NatsMicro instance.

func WithNatsURL

func WithNatsURL(url string) TinyServiceOption

WithNatsURL sets the NATS URL for the NatsMicro instance.

func WithStatsHandler

func WithStatsHandler(handler micro.StatsHandler) TinyServiceOption

WithStatsHandler sets the stats handler for the NatsMicro instance.

func WithVersion

func WithVersion(version string) TinyServiceOption

WithVersion sets the version for the NatsMicro instance.

Jump to

Keyboard shortcuts

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