streaming

package
v0.0.0-...-3295dff Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 (r *Route) GetQueueGroup() string

func (*Route) GetRoute

func (r *Route) GetRoute() string

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

func (*Stan) Subscribe

func (n *Stan) Subscribe(route string, handler stan.MsgHandler, opts ...stan.SubscriptionOption) error

Subscribe and record subscription to routes

func (*Stan) UnsubscribeAll

func (n *Stan) UnsubscribeAll()

Unsubscribe all handlers

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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