queue

package
v0.0.0-...-9259d71 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disable log

Types

type Client

type Client interface {
	Send(msg Message, waitReply bool) (err error) //同步发送消息
	SendTimeout(msg Message, waitReply bool, timeout time.Duration) (err error)
	Wait(msg Message) (Message, error)                               //等待消息处理完成
	WaitTimeout(msg Message, timeout time.Duration) (Message, error) //等待消息处理完成
	Recv() chan Message
	Sub(topic string) //订阅消息
	Close()
	CloseQueue() (*types.Reply, error)
	NewMessage(topic string, ty int64, data interface{}) (msg Message)
}

Client 消息队列的接口,每个模块都需要一个发送接受client

type Message

type Message struct {
	Topic string
	Ty    int64
	Id    int64
	Data  interface{}
	// contains filtered or unexported fields
}

Message message struct

func NewMessage

func NewMessage(id int64, topic string, ty int64, data interface{}) (msg Message)

NewMessage new message

func (Message) Err

func (msg Message) Err() error

Err if err return error msg, or return nil

func (Message) GetData

func (msg Message) GetData() interface{}

GetData get message data

func (Message) Reply

func (msg Message) Reply(replyMsg Message)

Reply reply message to reply chan

func (Message) ReplyErr

func (msg Message) ReplyErr(title string, err error)

ReplyErr reply error

func (Message) String

func (msg Message) String() string

String print the message information

type Module

type Module interface {
	SetQueueClient(client Client)
	Close()
}

Module be used for module interface

type Queue

type Queue interface {
	Close()
	Start()
	Client() Client
	Name() string
}

Queue only one obj in project Queue only generate Client and start、Close operate, if you send massage or receive massage on Queue, please use Client.

func New

func New(name string) Queue

New new queue struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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