Documentation ¶
Index ¶
- Constants
- func InitBus()
- func Push()
- type EventBus
- func (bus *EventBus) AddTopics(userKey string, topics ...string)
- func (bus *EventBus) GetEventChannel(userKey string) *EventChannel
- func (bus *EventBus) PubByTopic(topic string, params []byte)
- func (bus *EventBus) PubByUser(userKey string, params []byte)
- func (bus *EventBus) RemoveTopics()
- func (bus *EventBus) Sub(userKey string, topic *EventChannel) *EventChannel
- type EventChannel
- type EventData
- type EventMonitorItem
- type IMessage
- type Item
- type JsonBase
- type JsonBody
- type JsonError
- type JsonMsg
- func (m *JsonMsg) GetId() uint64
- func (m *JsonMsg) GetMessage() []byte
- func (m *JsonMsg) GetParams() interface{}
- func (m *JsonMsg) GetRequest() *JsonRequest
- func (m *JsonMsg) PackDecode(buf []byte, value interface{}) error
- func (m *JsonMsg) PackEncode() []byte
- func (m *JsonMsg) SetMessage(option *MsgOptions)
- type JsonNotify
- type JsonParams
- type JsonRequest
- type Message
- func (m *Message[T]) GetBytes() []byte
- func (m *Message[T]) GetData() string
- func (m *Message[T]) GetId() uint64
- func (m *Message[T]) GetMethod() string
- func (m *Message[T]) Pack()
- func (m *Message[T]) ProgramID() string
- func (m *Message[T]) RabbitMq(conf *gofkConf.MqConfig)
- func (m *Message[T]) RedisMq(conf *gofkConf.RedisConfig)
- func (m *Message[T]) Send(topic ...string) error
- func (m *Message[T]) Type() string
- func (m *Message[T]) UnPackFromBytes(msg []byte) *Message[T]
- type MessageOperator
- type MessageSub
- type MessageType
- type MsgAble
- type MsgOption
- type MsgOptions
- type PackageMsg
- type Subject
- type XMLBody
- type XMLHeader
- type XMLMsg
Constants ¶
View Source
const (
GlobalMidIncrementKey = "Auto-Increment-Message-Mid-Global"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventBus ¶
var (
Bus *EventBus
)
func (*EventBus) GetEventChannel ¶
func (bus *EventBus) GetEventChannel(userKey string) *EventChannel
func (*EventBus) PubByTopic ¶
func (*EventBus) RemoveTopics ¶
func (bus *EventBus) RemoveTopics()
func (*EventBus) Sub ¶
func (bus *EventBus) Sub(userKey string, topic *EventChannel) *EventChannel
type EventChannel ¶
type EventChannel struct {
// contains filtered or unexported fields
}
func NewTopic ¶
func NewTopic() *EventChannel
func (*EventChannel) Chan ¶
func (c *EventChannel) Chan() chan *EventData
type EventData ¶
type EventData struct {
// contains filtered or unexported fields
}
func NewEventData ¶
type EventMonitorItem ¶
type JsonBase ¶
type JsonBase struct { Method string `json:"method"` From string `json:"from,omitempty"` //调用者(登录人) To string `json:"to,omitempty"` //被调者 Origin string `json:"origin,omitempty"` //来源域名(或Ip) PlatFormId string `json:"platformId,omitempty"` //平台id Zone int `json:"zone,omitempty"` //时区 RemoteIP string `json:"remoteIP,omitempty"` //被调者Ip JWT interface{} `json:"jwt,omitempty"` //来源jwt验证信息 }
type JsonMsg ¶
type JsonMsg struct { *JsonRequest *JsonParams }
func AbleJsonMsg ¶
func AbleJsonMsg() *JsonMsg
func (*JsonMsg) GetMessage ¶
func (*JsonMsg) GetRequest ¶
func (m *JsonMsg) GetRequest() *JsonRequest
func (*JsonMsg) PackDecode ¶
func (*JsonMsg) PackEncode ¶
func (*JsonMsg) SetMessage ¶
func (m *JsonMsg) SetMessage(option *MsgOptions)
type JsonNotify ¶
type JsonNotify struct { ProgramID string `json:"programId,omitempty"` //系统程序id Id uint64 `json:"id,omitempty"` //消息id Type MessageType `json:"type,omitempty"` //消息类型 SubType MessageSub `json:"subType,omitempty"` //一级类型(二级类型) Operator MessageOperator `json:"operator,omitempty"` //仅Data类型消息才有操作权限 Timestamp int64 `json:"timestamp,omitempty"` //消息推送的时间戳 KeepaliveTime time.Duration `json:"keepaliveTime,omitempty"` //定时消息同步间隔时间 }
type JsonParams ¶
type JsonParams struct {
Params interface{} `json:"params,omitempty"`
}
type JsonRequest ¶
type Message ¶
type Message[T MsgAble] struct { Able T MqRabbit *mq.RabbitMQ MqRedis *redis.Client Opts *MsgOptions }
func NewMessage ¶
func (*Message[T]) RedisMq ¶
func (m *Message[T]) RedisMq(conf *gofkConf.RedisConfig)
func (*Message[T]) UnPackFromBytes ¶
type MessageOperator ¶
type MessageOperator string
const ( AddIncrement MessageOperator = "addIncrement" EditIncrement MessageOperator = "editIncrement" QueryOperator MessageOperator = "queryOperator" )
type MessageSub ¶
type MessageSub string
type MessageType ¶
type MessageType string
const ( MonitorHeartBeat MessageType = "HeartBeat" //监控心跳 WebSocketKeepalive MessageType = "webSocketKeepalive" DataSync MessageType = "DataSync" //数据同步(增量递增,单位:天) DataResponse MessageType = "DataResponse" //数据响应 )
type MsgAble ¶
type MsgAble interface { *JsonMsg | *XMLMsg PackageMsg }
type MsgOption ¶
type MsgOption func(options *MsgOptions)
func WithJsonNotify ¶
func WithJsonNotify(notify *JsonNotify) MsgOption
func WithMethod ¶
func WithParams ¶
func WithParams(params interface{}) MsgOption
func WithRequest ¶
func WithRequest(request *JsonRequest) MsgOption
type MsgOptions ¶
type MsgOptions struct { Id uint64 *JsonParams *JsonBody *JsonNotify *JsonBase *JsonError *XMLHeader *XMLBody }
type PackageMsg ¶
type PackageMsg interface { PackEncode() []byte PackDecode(data []byte, value interface{}) error SetMessage(options *MsgOptions) GetMessage() []byte }
type XMLBody ¶
type XMLBody struct { Items []struct { Data string `xml:",innerxml"` } `xml:"items"` }
type XMLMsg ¶
type XMLMsg struct { XMLName xml.Name `xml:"Msg"` Head *XMLHeader `xml:"Head"` Body *XMLBody `xml:"Body"` }
func AbleXmlMsg ¶
func AbleXmlMsg() *XMLMsg
func (*XMLMsg) GetMessage ¶
func (*XMLMsg) PackDecode ¶
func (*XMLMsg) PackEncode ¶
func (*XMLMsg) SetMessage ¶
func (m *XMLMsg) SetMessage(option *MsgOptions)
Click to show internal directories.
Click to hide internal directories.