commandbusnats

package
v0.0.0-...-5fa8032 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	subject string,
	conn *nats.Conn,
	opts ...ClientOption,
) *Client

func (*Client) CommandSink

func (c *Client) CommandSink(ctx context.Context, cmd *command.Command) (*command.Reply, error)

type ClientOption

type ClientOption func(*Client)

func WithClientCodec

func WithClientCodec(c *command.Codec) ClientOption

func WithClientContextFunc

func WithClientContextFunc(fn ContextFunc) ClientOption

func WithClientRequestFunc

func WithClientRequestFunc(fn ClientRequestFunc) ClientOption

func WithClientResponseFunc

func WithClientResponseFunc(fn ClientResponseFunc) ClientOption

func WithClientTimeout

func WithClientTimeout(dur time.Duration) ClientOption

type ClientRequestFunc

type ClientRequestFunc func(h nats.Header, c *command.Command)

type ClientResponseFunc

type ClientResponseFunc func(h nats.Header, c *command.Reply)

type ContextFunc

type ContextFunc func(ctx context.Context) context.Context

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	subject string,
	mutator stream.CommandSinker,
	opts ...ServerOption,
) *Server

func (*Server) Listen

func (s *Server) Listen(conn *nats.Conn) error

type ServerErrorHandler

type ServerErrorHandler func(msg *nats.Msg, err error)

type ServerOption

type ServerOption func(*Server)

func WithServerCodec

func WithServerCodec(c command.Encoding) ServerOption

func WithServerContextFunc

func WithServerContextFunc(fn ContextFunc) ServerOption

func WithServerErrorHandler

func WithServerErrorHandler(fn ServerErrorHandler) ServerOption

func WithServerRequestFunc

func WithServerRequestFunc(fn ServerRequestFunc) ServerOption

func WithServerResponseFunc

func WithServerResponseFunc(fn ServerResponseFunc) ServerOption

type ServerRequestFunc

type ServerRequestFunc func(h nats.Header, c *command.Command)

type ServerResponseFunc

type ServerResponseFunc func(h nats.Header, r *command.Reply)

Jump to

Keyboard shortcuts

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