Documentation ¶
Index ¶
- Constants
- Variables
- type Option
- func DisableRestart() Option
- func EnableTcpKeepAlive() Option
- func WithAttach() Option
- func WithCtx(val context.Context) Option
- func WithEndpoint(val string) Option
- func WithExitWaitTimeout(val time.Duration) Option
- func WithHeartbeatIvlSec(val int) Option
- func WithHeartbeatTTLSec(val int) Option
- func WithHeartbeatTimoutSec(val int) Option
- func WithInChannel(val chan []byte) Option
- func WithMaxBufferSize(val int) Option
- func WithOutChannel(val chan []byte) Option
- func WithRecvTimeoutSec(val int) Option
- func WithRetryAttempts(val int) Option
- func WithRetryInterval(val time.Duration) Option
- func WithSendTimeoutSec(val int) Option
- func WithSndhwm(val int) Option
- func WithTcpKeepAliveCnt(val int) Option
- func WithTcpKeepAliveIdleSec(val int) Option
- func WithType(val string) Option
- type RetryMsg
- type Sock
- func (s *Sock) Attach() (*goczmq.Sock, error)
- func (s *Sock) Consumer()
- func (s *Sock) EmptyBuffer() bool
- func (s *Sock) GetDropMsgCount() uint64
- func (s *Sock) GetID() string
- func (s *Sock) GetInChannel() chan []byte
- func (s *Sock) GetInCount() int
- func (s *Sock) GetOutChannel() chan []byte
- func (s *Sock) GetOutCount() int
- func (s *Sock) GetRecvMsgCount() uint64
- func (s *Sock) GetRetryCount() int
- func (s *Sock) GetSendMsgCount() uint64
- func (s *Sock) IsAutoRestart() bool
- func (s *Sock) Publisher()
- func (s *Sock) Release() error
- func (s *Sock) Requester()
- func (s *Sock) Responser()
- func (s *Sock) StopAutoRestart()
Constants ¶
const ( DefaultRetryAttempts = uint8(5) DefaultRetryInterval = time.Second DefaultExitWaitTimeout = time.Second * 30 DefaultMaxBufferSize = 10000 DefaultTcpKeepAliveCnt = -1 DefaultTcpKeepAliveIdleSec = -1 DefaultHeartbeatTTLSec = 30 // unit: millisecond DefaultHeartbeatTimeoutSec = 5 // unit: millisecond DefaultHeartbeatIvlSec = 15 // unit: millisecond DefaultReconnectIvlMillSec = 100 DefaultReconnectIvlMaxMillSec = 0 DefaultSndhwm = 10000 DefaultSendTimeoutSec = 0 DefaultRecvTimeoutSec = 0 )
Variables ¶
var Pool = pool.DefaultPool()
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(s *Sock)
func DisableRestart ¶
func DisableRestart() Option
func EnableTcpKeepAlive ¶
func EnableTcpKeepAlive() Option
func WithAttach ¶
func WithAttach() Option
func WithEndpoint ¶
func WithExitWaitTimeout ¶
func WithHeartbeatIvlSec ¶
func WithHeartbeatTTLSec ¶
func WithHeartbeatTimoutSec ¶
func WithInChannel ¶ added in v1.0.1
func WithMaxBufferSize ¶
func WithOutChannel ¶ added in v1.0.1
func WithRecvTimeoutSec ¶ added in v1.0.1
func WithRetryAttempts ¶
func WithRetryInterval ¶
func WithSendTimeoutSec ¶ added in v1.0.1
func WithSndhwm ¶
func WithTcpKeepAliveCnt ¶
func WithTcpKeepAliveIdleSec ¶
type RetryMsg ¶
func NewRetryMsg ¶
func (*RetryMsg) GetRetryTimes ¶ added in v1.0.1
GetRetryTimes gets msg current retry times
func (*RetryMsg) IterRetryTimes ¶
func (r *RetryMsg) IterRetryTimes()
IterRetryTimes used to iter the retry times
type Sock ¶
type Sock struct { ID string MaxBufferSize int // socket connection args Type int Endpoint string Sndhwm int // reconnect args DisableRestart atom.AtomicBool ReconnectIvlMillSec int ReconnectIvlMaxMillSec int // heartbeat args HeartbeatIvlSec uint16 HeartbeatTimoutSec uint16 HeartbeatTTLSec uint16 // tcp args EnableTcpKeepAlive bool TcpKeepAliveIdleSec int16 TcpKeepAliveCnt int8 RetryInterval time.Duration RetryAttempts uint8 // safe destroy args ExitWaitTimeout time.Duration SendTimeoutSec uint16 RecvTimeoutSec uint16 // contains filtered or unexported fields }
func (*Sock) Attach ¶
Attach attaches a socket to zero or more endpoints.
call bind when attach is equal to false call connect when attach is equal to true
func (*Sock) Consumer ¶
func (s *Sock) Consumer()
Consumer receive msg from sock and charge into 'out' channel. optional socket type: SUB/PULL
func (*Sock) EmptyBuffer ¶
func (*Sock) GetDropMsgCount ¶ added in v1.0.2
GetDropMsgCount gets the total count of msg sock has dropped ever
func (*Sock) GetInChannel ¶
GetInChannel returns in channel
func (*Sock) GetInCount ¶
GetInCount gets msg count int channel 'in'
func (*Sock) GetOutChannel ¶
GetOutChannel returns out channel
func (*Sock) GetOutCount ¶
GetOutCount gets msg count int channel 'out'
func (*Sock) GetRecvMsgCount ¶ added in v1.0.2
GetRecvMsgCount gets the total count of msg sock has received
func (*Sock) GetRetryCount ¶
GetRetryCount gets msg count int channel 'retryCh'
func (*Sock) GetSendMsgCount ¶ added in v1.0.2
GetSendMsgCount gets the total count of msg sock has published
func (*Sock) IsAutoRestart ¶
IsAutoRestart gets the value of DisableRestart
func (*Sock) Publisher ¶
func (s *Sock) Publisher()
Publisher sends msg in 'in' channel. optional sock type: PUB/PUSH
func (*Sock) Requester ¶ added in v1.0.1
func (s *Sock) Requester()
Requester send request msg in 'in' channel and save reply msg in 'out' channel
func (*Sock) Responser ¶ added in v1.0.1
func (s *Sock) Responser()
Responser recharge request msg into 'out' channel and get its response msg from 'in' channel
func (*Sock) StopAutoRestart ¶
func (s *Sock) StopAutoRestart()
StopAutoRestart sets DisableRestart to true