Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigureLogger(stanOpts *Options, natsOpts *natsd.Options)
- func Debugf(format string, v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Noticef(format string, v ...interface{})
- func ProcessConfigFile(configFile string, opts *Options) error
- func RemoveLogger()
- func Tracef(format string, v ...interface{})
- type Options
- type StanServer
Constants ¶
const ( // VERSION is the current version for the NATS Streaming server. VERSION = "0.3.6" DefaultClusterID = "test-cluster" DefaultDiscoverPrefix = "_STAN.discover" DefaultPubPrefix = "_STAN.pub" DefaultSubPrefix = "_STAN.sub" DefaultSubClosePrefix = "_STAN.subclose" DefaultUnSubPrefix = "_STAN.unsub" DefaultClosePrefix = "_STAN.close" DefaultStoreType = stores.TypeMemory // DefaultHeartBeatInterval is the interval at which server sends heartbeat to a client DefaultHeartBeatInterval = 30 * time.Second // DefaultClientHBTimeout is how long server waits for a heartbeat response DefaultClientHBTimeout = 10 * time.Second // DefaultMaxFailedHeartBeats is the number of failed heartbeats before server closes // the client connection (total= (heartbeat interval + heartbeat timeout) * (fail count + 1) DefaultMaxFailedHeartBeats = int((5 * time.Minute) / DefaultHeartBeatInterval) // DefaultIOBatchSize is the maximum number of messages to accumulate before flushing a store. DefaultIOBatchSize = 1024 // DefaultIOSleepTime is the duration (in micro-seconds) the server waits for more messages // before starting processing. Set to 0 (or negative) to disable the wait. DefaultIOSleepTime = int64(0) )
Server defaults.
Variables ¶
var ( ErrInvalidSubject = errors.New("stan: invalid subject") ErrInvalidSequence = errors.New("stan: invalid start sequence") ErrInvalidTime = errors.New("stan: invalid start time") ErrInvalidSub = errors.New("stan: invalid subscription") ErrInvalidClient = errors.New("stan: clientID already registered") ErrInvalidAckWait = errors.New("stan: invalid ack wait time, should be >= 1s") ErrInvalidConnReq = errors.New("stan: invalid connection request") ErrInvalidPubReq = errors.New("stan: invalid publish request") ErrInvalidSubReq = errors.New("stan: invalid subscription request") ErrInvalidUnsubReq = errors.New("stan: invalid unsubscribe request") ErrInvalidCloseReq = errors.New("stan: invalid close request") ErrDupDurable = errors.New("stan: duplicate durable registration") ErrInvalidDurName = errors.New("stan: durable name of a durable queue subscriber can't contain the character ':'") ErrUnknownClient = errors.New("stan: unknown clientID") )
Errors.
var DefaultNatsServerOptions = server.Options{ Host: "localhost", Port: 4222, NoLog: true, NoSigs: true, }
DefaultNatsServerOptions are default options for the NATS server
Functions ¶
func ConfigureLogger ¶
ConfigureLogger configures logging for STAN and the embedded NATS server based on options passed.
func ProcessConfigFile ¶ added in v0.3.0
ProcessConfigFile parses the configuration file `configFile` and updates the given Streaming options `opts`.
func RemoveLogger ¶
func RemoveLogger()
RemoveLogger clears the logger instance and debug/trace flags. Used for testing.
Types ¶
type Options ¶
type Options struct { ID string DiscoverPrefix string StoreType string FilestoreDir string FileStoreOpts stores.FileStoreOptions stores.StoreLimits // Store limits (MaxChannels, etc..) Trace bool // Verbose trace Debug bool // Debug trace Secure bool // Create a TLS enabled connection w/o server verification ClientCert string // Client Certificate for TLS ClientKey string // Client Key for TLS ClientCA string // Client CAs for TLS IOBatchSize int // Number of messages we collect from clients before processing them. IOSleepTime int64 // Duration (in micro-seconds) the server waits for more message to fill up a batch. NATSServerURL string // URL for external NATS Server to connect to. If empty, NATS Server is embedded. ClientHBInterval time.Duration // Interval at which server sends heartbeat to a client. ClientHBTimeout time.Duration // How long server waits for a heartbeat response. ClientHBFailCount int // Number of failed heartbeats before server closes client connection. }
Options for STAN Server
func GetDefaultOptions ¶
func GetDefaultOptions() (o *Options)
GetDefaultOptions returns default options for the STAN server
type StanServer ¶
StanServer structure represents the STAN server
func RunServer ¶
func RunServer(ID string) *StanServer
RunServer will startup an embedded STAN server and a nats-server to support it.
func RunServerWithOpts ¶
func RunServerWithOpts(stanOpts *Options, natsOpts *server.Options) *StanServer
RunServerWithOpts will startup an embedded STAN server and a nats-server to support it.
func (*StanServer) ClusterID ¶
func (s *StanServer) ClusterID() string
ClusterID returns the STAN Server's ID.
func (*StanServer) Shutdown ¶
func (s *StanServer) Shutdown()
Shutdown will close our NATS connection and shutdown any embedded NATS server.