Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrClientDisconnected = errors.New("could not reach nats: connection closed")
)
Functions ¶
This section is empty.
Types ¶
type AddStreamOptions ¶
type AddStreamOptions struct {
StreamName string
}
type Client ¶
type Client interface { server.NamedMonitor io.Closer AddStream(ctx context.Context, opts *AddStreamOptions) error Publish(ctx context.Context, opts *PublishOptions) error }
type ClientOption ¶
type ClientOption func(*DefaultClient)
func WithEventListeners ¶ added in v0.2.1
func WithEventListeners(listeners ...EventListener) ClientOption
func WithLogger ¶
func WithLogger(logger *slog.Logger) ClientOption
func WithNatsUrl ¶
func WithNatsUrl(url string) ClientOption
type DefaultClient ¶
type DefaultClient struct {
// contains filtered or unexported fields
}
func NewDefaultClient ¶
func NewDefaultClient(opts ...ClientOption) (*DefaultClient, error)
func (*DefaultClient) AddStream ¶
func (c *DefaultClient) AddStream(ctx context.Context, opts *AddStreamOptions) error
func (*DefaultClient) Close ¶
func (c *DefaultClient) Close() error
func (*DefaultClient) Name ¶
func (c *DefaultClient) Name() string
func (*DefaultClient) Publish ¶
func (c *DefaultClient) Publish(ctx context.Context, opts *PublishOptions) error
type EventListener ¶ added in v0.2.1
type EventListener func(*DefaultClient)
func OnMsgFailedEvent ¶ added in v0.2.1
func OnMsgFailedEvent(onMsgFailedEvent func(subj string, duration time.Duration)) EventListener
func OnMsgPublishedEvent ¶ added in v0.2.1
func OnMsgPublishedEvent(onMsgPublishedEvent func(subj string, duration time.Duration)) EventListener
type PublishOptions ¶
Click to show internal directories.
Click to hide internal directories.