push

package
v0.0.0-...-02b4230 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

*

*
* @author liangjf
* @create on 2020/6/3
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/2
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/2
* @version 1.0

Index

Constants

View Source
const (
	Push2One = iota + 1
	Push2App
	Push2All
)

推送类型

View Source
const (
	AppGpusher = iota + 1000
)

app应用列表 TODO save in etcd

View Source
const (
	MaxExpireTime = 3600 * 24 * 7 //消息最大过期时间7天
)

Variables

View Source
var (
	AppM = map[string]int32{
		"app_gpusher": AppGpusher,
	}
)
View Source
var (
	ErrChannelIsClosed = errors.New("channel is closed")
)

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	// contains filtered or unexported fields
}

func (*Consumer) Cleanup

func (consumer *Consumer) Cleanup(s sarama.ConsumerGroupSession) error

func (*Consumer) ConsumeClaim

func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

func (*Consumer) Setup

func (consumer *Consumer) Setup(s sarama.ConsumerGroupSession) error

type IQueueReceiver

type IQueueReceiver interface {
	Init() error
	Recv(func([]byte)) error
	Stop()
}

func NewKafkaReceiver

func NewKafkaReceiver(brokerAddrs []string) IQueueReceiver

type IQueueSender

type IQueueSender interface {
	Init() error
	Send(*PushMsg) error
	Stop()
}

func NewKafkaSender

func NewKafkaSender(brokerAddrs []string, isSync bool) IQueueSender

type KafkaReceiver

type KafkaReceiver struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

KafkaReceiver kafka接收者

func (*KafkaReceiver) Init

func (q *KafkaReceiver) Init() error

func (*KafkaReceiver) Recv

func (q *KafkaReceiver) Recv(f func([]byte)) error

func (*KafkaReceiver) Stop

func (q *KafkaReceiver) Stop()

type KafkaSender

type KafkaSender struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

KafkaSender kafka发送者

func (*KafkaSender) Init

func (q *KafkaSender) Init() error

func (*KafkaSender) Send

func (q *KafkaSender) Send(msg *PushMsg) error

func (*KafkaSender) Stop

func (q *KafkaSender) Stop()

type MsgBody

type MsgBody struct {
	Type        int    `json:"type"`   //推送类型(个体, 同一个app, 全体)
	MsgSeq      uint64 `json:"msgSeq"` //消息序号, 用于ack和持久化
	UUID        string `json:"uuid"`
	Content     string `json:"content"`
	ExpireTime  uint32 `json:"expireTime"`
	OfflinePush bool   `json:"offlinePush"`
}

func (MsgBody) String

func (m MsgBody) String() string

type PushMsg

type PushMsg struct {
	Tag  string  `json:"tag"`
	Body MsgBody `json:"body"`
}

func (PushMsg) String

func (p PushMsg) String() string

Jump to

Keyboard shortcuts

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