Documentation
¶
Overview ¶
Package utils provides zmq connection pool
Package utils provides ...
这里提供Mutex锁, 如果需要多线程访问zmq的socket,使用这个
Index ¶
- Constants
- func Dump(soc *zmq.Socket)
- func GetLocalIdentity(namespace string) (string, error)
- func ReqNewer(endpoint string) func() (*zmq.Socket, error)
- func RequestAndReply(soc *zmq.Socket, timeout time.Duration, msg ...interface{}) (reply []string, err error)
- func Unwrap(msg []string) (head string, tail []string)
- type MQ
- type MQPool
- type Pool
- type PoolLogger
- type PooledSocket
- type Socket
Constants ¶
View Source
const (
BLOCK_DURATION = 3 * time.Second //默认阻塞时间
)
Variables ¶
This section is empty.
Functions ¶
func GetLocalIdentity ¶
Types ¶
type MQPool ¶
type MQPool struct { //Pool map[string]*msgqueue Pool map[string]*MQ // contains filtered or unexported fields }
type Pool ¶
type Pool struct { // 获取新连接的方法 New func() (*zmq.Socket, error) Max int Wait bool //当连接池满的时候是否等待 Life time.Duration // contains filtered or unexported fields }
func NewPool ¶
{{{ func NewPool(newFn func() (*zmq.Socket, error), ext ...interface{}) *Pool * NewPool creates a new pool. This function is deprecated. Applications should * initialize the Pool fields directly as shown in example.
func NewPool(newFn func() (*zmq.Socket, error), max int, life time.Duration) *Pool {
type PoolLogger ¶
type PoolLogger interface {
Printf(format string, v ...interface{})
}
type PooledSocket ¶
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
func (*Socket) RecvMessage ¶
{{{ func (s *Socket) RecvMessage(flags int) (msg []string, err error) { return s.soc.RecvMessage(zmq4.Flag(flags)) *
func (*Socket) SendMessage ¶
{{{ func (s *Socket) SendMessage(parts ...interface{}) (total int, err error) { *
Click to show internal directories.
Click to hide internal directories.