notice

package
v0.0.0-...-c3d2762 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JobQueue chan Job

A buffered channel that we can send work requests on.

Functions

This section is empty.

Types

type ArticleNotice

type ArticleNotice struct {
	OpenID      string
	Title       string
	Description string
	PicURL      string
	URL         string
}

ArticleNotice struct

func (*ArticleNotice) Send

func (n *ArticleNotice) Send()

Send Notice.Run

type Dispatcher

type Dispatcher struct {
	// A pool of workers channels that are registered with the dispatcher
	MaxWorkers int
	WorkerPool chan chan Job
}

func NewDispatcher

func NewDispatcher(maxWorkers int) *Dispatcher

func (*Dispatcher) Run

func (d *Dispatcher) Run()

type EmailNotice

type EmailNotice struct {
	Address string
	Title   string
	Body    string
}

EmailNotice struct

func (*EmailNotice) Send

func (n *EmailNotice) Send()

Send Notice.Run

type FollowMSG

type FollowMSG struct {
	Name template.DataItem `json:"name"`
}

FollowMSG 关注通知消息结构

type Job

type Job struct {
	Notice Notice
}

Job represents the job to be run

type Notice

type Notice interface {
	Send()
}

Notice 通知接口

type NoticeDemo

type NoticeDemo struct {
	OpenID string
	Text   string
}

NoticeDemo struct

func (*NoticeDemo) Send

func (p *NoticeDemo) Send()

Send Notice.Run

type TextNotice

type TextNotice struct {
	OpenID string
	Text   string
}

TextNotice struct

func (*TextNotice) Send

func (n *TextNotice) Send()

Send Notice.Run

type Worker

type Worker struct {
	WorkerPool chan chan Job
	JobChannel chan Job
	// contains filtered or unexported fields
}

Worker represents the worker that executes the job

func NewWorker

func NewWorker(workerPool chan chan Job) Worker

func (Worker) Start

func (w Worker) Start()

Start method starts the run loop for the worker, listening for a quit channel in case we need to stop it

func (Worker) Stop

func (w Worker) Stop()

Stop signals the worker to stop listening for work requests.

Jump to

Keyboard shortcuts

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