mq

package
v0.0.0-...-840a1b4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const Key = "mq"

Key is the key name of the message queue in the Gin context.

Variables

View Source
var (
	MsgSendMail = "send_mail"
)

Functions

func Publish

func Publish(c *gin.Context, m M)

Publish the message.

func ToContext

func ToContext(c Setter, mq MQ)

ToContext adds the message queue to this context if it supports the Setter interface.

Types

type M

type M struct {
	Topic string
	Data  interface{}
}

M represents a message.

type MQ

type MQ interface {
	Publish(M)
}

MQ wraps the functions that interactive with the message queue.

func FromContext

func FromContext(c context.Context) MQ

FromContext returns the message queue associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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