Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrServerAlreadyStarted = errors.New("server already started")
)
Functions ¶
func ParseError ¶
func ParseError(msg *nats.Msg) error
Types ¶
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
A client configuration value
func Timeout ¶
func Timeout(to time.Duration) ClientOption
Set the maximum amount of time the client will wait for a response from a server
type ClientOptions ¶
type ClientOptions struct { // Timeout sets the amount of time that a client will // wait for a response from the server Timeout time.Duration // Namespace will be added to the beginning of all NATS // subjects used by the client, effectively allowing // multiple servers to be run and accessed manually. Namespace string }
Client configuration values
func NewClientOptions ¶
func NewClientOptions(options ...ClientOption) (*ClientOptions, error)
func (*ClientOptions) ApplyNamespace ¶
func (opt *ClientOptions) ApplyNamespace(to string) string
type Option ¶
type Option interface { ServerOption ClientOption }
An option that can be used on both the server and client.
func HashNamespace ¶
Generate a namespace by taking a SHA-256 hash of the inputs. This is useful for generating a namespace from values that may have illegal characters for a NATS subject name.
type Server ¶
type Server interface { // Info returns the service info. Info() micro.Info // Stats returns statistics for the service endpoint and all monitoring endpoints. Stats() micro.Stats // Reset resets all statistics (for all endpoints) on a service instance. Reset() // Stop drains the endpoint subscriptions and marks the service as stopped. Stop() error // Stopped informs whether [Stop] was executed on the service. Stopped() bool }
type ServerFunc ¶
type ServerFunc func() error
func (ServerFunc) Stop ¶
func (sf ServerFunc) Stop() error
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
A server configuration value
func BufferSize ¶
func BufferSize(bs int) ServerOption
Set the maximum number of buffered messages for each server endpoint
func ErrorHandler ¶
func ErrorHandler(eh func(error)) ServerOption
Set the error handler for the server.
func QueueGroup ¶
func QueueGroup(qg string) ServerOption
Set the NATS queue group name for the server
type ServerOptions ¶
type ServerOptions struct { // Namespace will be added to the beginning of all NATS // subjects the server listens on, effectively allowing // multiple servers to be run. Namespace string // QueueGroup can be used to ensure that requests are only // sent to a single server when running multiple in parallel. QueueGroup string // A handler for errors that occur during service calls. ErrorHandler func(error) // The maximum number of pending messages that each endpoint // in the server supports. This size is per-endpoint. BufferSize int }
func NewServerOptions ¶
func NewServerOptions(options ...ServerOption) (*ServerOptions, error)
func (*ServerOptions) ApplyNamespace ¶
func (opt *ServerOptions) ApplyNamespace(to micro.Group) micro.Group
Click to show internal directories.
Click to hide internal directories.