Documentation ¶
Index ¶
- type OptionsFunc
- type PayloadWithContext
- type Route
- type Stan
- func (n *Stan) Publish(subject string, data PayloadWithContext) error
- func (n *Stan) PublishAsync(subject string, data PayloadWithContext, ackH stan.AckHandler) (string, error)
- func (n *Stan) QueueSubscribe(route string, group string, handler stan.MsgHandler, ...) error
- func (n *Stan) Subscribe(route string, handler stan.MsgHandler, opts ...stan.SubscriptionOption) error
- func (n *Stan) UnsubscribeAll()
- type StanOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionsFunc ¶
type OptionsFunc func(*StanOptions) error
Function for applying options to StanOptions in NewStanOptions Using a function allows for a chain or heirarchy when applying them eg func1 then func2 then func3 Internally allows for default options to be applied first.
type PayloadWithContext ¶
type PayloadWithContext interface { proto.Message GetContext() *NatsContext SetContext(*NatsContext) }
For use when using nats request/publish/publishrequest wrapper functions
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Holds route info including subscription holds route,handler,nats subscripiton and queue group.
func (*Route) GetHandler ¶
func (r *Route) GetHandler() stan.MsgHandler
func (*Route) GetQueueGroup ¶
func (*Route) GetSubscription ¶
func (r *Route) GetSubscription() stan.Subscription
type Stan ¶
type Stan struct { Opts *StanOptions Con stan.Conn }
stan.Options wrapper.
func (*Stan) Publish ¶
func (n *Stan) Publish(subject string, data PayloadWithContext) error
Wrapper for stan Publish function. Needs a payload which has a context object (see PayloadWithContext type) Adds a context if it doesn't exist. Otherwise appends which app and time that this message is being sent at. Adds a traceID if not already there
func (*Stan) PublishAsync ¶
func (n *Stan) PublishAsync(subject string, data PayloadWithContext, ackH stan.AckHandler) (string, error)
Wrapper for stan PublishAsync function with context. Adds a context if it doesn't exist. Otherwise appends which app and time that this message is being sent at. Adds a traceID if not already there
func (*Stan) QueueSubscribe ¶
func (n *Stan) QueueSubscribe(route string, group string, handler stan.MsgHandler, opts ...stan.SubscriptionOption) error
Subscribe to queue group and record subscription to routes
type StanOptions ¶
type StanOptions struct { nats.Options ClientId string ClusterId string // contains filtered or unexported fields }
func NewStanOptions ¶
func NewStanOptions(optionFuncs ...OptionsFunc) (options *StanOptions)
Initiating nats with default options and then applies each option func in order on top of that.
func (*StanOptions) Connect ¶
func (stanOpts *StanOptions) Connect() (*Stan, error)
Start subscribing to subjects/routes.