zmq

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const QUEUE_GET_SIZE = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientOrServer

type ClientOrServer int
const (
	CLIENT ClientOrServer = iota
	SERVER
)

type Publisher

type Publisher struct {
	*zmq.Socket
}

Publisher is a wrapped ZeroMQ socket for publish

func (*Publisher) Close

func (p *Publisher) Close() error

Close socket

func (*Publisher) Send

func (p *Publisher) Send(b []byte) (n int, err error)

Send to ZeroMQ

func (*Publisher) SendNoBlock

func (p *Publisher) SendNoBlock(b []byte) (n int, err error)

SendNoBlock to ZeroMQ

type Puller

type Puller struct {
	*zmq.Socket
}

Puller is a wrapped ZeroMQ socket for subscribe

func (*Puller) Close

func (p *Puller) Close() error

Close socket

func (*Puller) Recv

func (s *Puller) Recv() ([]byte, error)

Recv from ZeroMQ

func (*Puller) RecvNoBlock

func (s *Puller) RecvNoBlock() ([]byte, error)

RecvNoBlock from ZeroMQ

type Pusher

type Pusher struct {
	*zmq.Socket
}

Pusher is a wrapped ZeroMQ socket for publish

func (*Pusher) Close

func (p *Pusher) Close() error

Close socket

func (*Pusher) Send

func (p *Pusher) Send(b []byte) (n int, err error)

Send to ZeroMQ

func (*Pusher) SendNoBlock

func (p *Pusher) SendNoBlock(b []byte) (n int, err error)

SendNoBlock to ZeroMQ

type Receiver

type Receiver interface {
	Recv() ([]byte, error)
	RecvNoBlock() ([]byte, error)
	io.Closer
}

func NewPuller

func NewPuller(ip string, port int, hwm int, recvBlockTimeout time.Duration, mode ClientOrServer) (Receiver, error)

NewPuller returns ZeroMQ TCP subscribe on specified ip and port

func NewSubscriber

func NewSubscriber(ip string, port int, hwm int, mode ClientOrServer) (Receiver, error)

NewSubscriber returns ZeroMQ TCP subscribe on specified ip and port

type Sender

type Sender interface {
	Send(b []byte) (n int, err error)
	SendNoBlock(b []byte) (n int, err error)
	io.Closer
}

func NewPublisher

func NewPublisher(ip string, port int, hwm int, mode ClientOrServer) (Sender, error)

NewPublisher returns ZeroMQ TCP publisher on specified port

func NewPusher

func NewPusher(ip string, port int, hwm int, mode ClientOrServer) (Sender, error)

NewPusher returns ZeroMQ TCP publisher on specified port

type Subscriber

type Subscriber struct {
	*zmq.Socket
}

Subscriber is a wrapped ZeroMQ socket for subscribe

func (*Subscriber) Close

func (s *Subscriber) Close() error

Close socket

func (*Subscriber) Recv

func (s *Subscriber) Recv() ([]byte, error)

Recv from ZeroMQ

func (*Subscriber) RecvNoBlock

func (s *Subscriber) RecvNoBlock() ([]byte, error)

RecvNoBlock from ZeroMQ

type ZMQBytePusher

type ZMQBytePusher struct {
	Sender
	// contains filtered or unexported fields
}

func NewZMQBytePusher

func NewZMQBytePusher(ip string, port uint16, zmqHWM int, t zmq4.Type) *ZMQBytePusher

NewZMQBytePusher 包装zmq pusher

func (*ZMQBytePusher) QueueForward

func (s *ZMQBytePusher) QueueForward(q queue.QueueReader)

QueueForward 不断读取q中的数据,并通过创建的zmq socket向外发送

func (*ZMQBytePusher) Send

func (s *ZMQBytePusher) Send(b []byte)

Send 向创建的zmq socket阻塞发送数据

Jump to

Keyboard shortcuts

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