Documentation
¶
Index ¶
- type NatsConnection
- type NatsHandler
- type NatsHandlerPlainData
- type NatsService
- func NewNatsServiceWithBasicAuth(lc fx.Lifecycle, config configuration.Config, logger log.Logger, ...) NatsService
- func NewNatsServiceWithJWTAuth(lc fx.Lifecycle, config configuration.Config, ...) NatsService
- func NewNatsServiceWithoutConnection(logger log.Logger) NatsService
- func NewTraceNatsServiceWithBasicAuth(lc fx.Lifecycle, tracer opentracing.Tracer, config configuration.Config, ...) NatsService
- func NewTraceNatsServiceWithJWTAuth(lc fx.Lifecycle, tracer opentracing.Tracer, config configuration.Config, ...) NatsService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NatsConnection ¶
type NatsHandler ¶
type NatsHandler interface {
Exec() (interface{}, ServiceReply)
}
type NatsHandlerPlainData ¶
type NatsService ¶
type NatsService interface { PublishExternal(subj string, msg []byte) error Publish(subj string, data interface{}) error RequestExternal(subj string, msg []byte, timeout time.Duration) ([]byte, error) Request(c context.Context, subj string, data interface{}, timeout time.Duration, target interface{}) ServiceReply QueueSubscribe(subj, queue string, handler NatsHandler) error QueueSubscribeExternal(subj, queue string, handler NatsHandlerPlainData) error Subscribe(subj string, handler NatsHandler) error SubscribeExternal(subj string, handler NatsHandlerPlainData) error Unsubscribe(subj string) error QueueUnsubscribe(subj, queue string) error SetConnectionFailedHandler(func(err error)) Connect(natsUrl, serviceName string, authOpt nats.Option, connectionAttempts, reconnectionAttempts, reconnectWaitSec, maxPingsOutstanding, pingIntervalSec int) error IsNoResponderErr(err error) bool }
func NewNatsServiceWithBasicAuth ¶
func NewNatsServiceWithBasicAuth(lc fx.Lifecycle, config configuration.Config, logger log.Logger, credentials credentials.CredentialsGetter) NatsService
func NewNatsServiceWithJWTAuth ¶
func NewNatsServiceWithJWTAuth(lc fx.Lifecycle, config configuration.Config, credentials credentials.CredentialsGetter, logger log.Logger) NatsService
func NewNatsServiceWithoutConnection ¶
func NewNatsServiceWithoutConnection(logger log.Logger) NatsService
This allows a 2 phase intialization: Usage: natsSvc := NewNatsServiceWithoutConnection(logger) ... err:=natsSvc.Connect
func NewTraceNatsServiceWithBasicAuth ¶ added in v0.5.0
func NewTraceNatsServiceWithBasicAuth(lc fx.Lifecycle, tracer opentracing.Tracer, config configuration.Config, logger log.Logger, credentials credentials.CredentialsGetter) NatsService
func NewTraceNatsServiceWithJWTAuth ¶ added in v0.5.0
func NewTraceNatsServiceWithJWTAuth(lc fx.Lifecycle, tracer opentracing.Tracer, config configuration.Config, credentials credentials.CredentialsGetter, logger log.Logger) NatsService
Click to show internal directories.
Click to hide internal directories.