messenger

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActive

func GetActive(ctx context.Context) bool

func GetConnect

func GetConnect(ctx context.Context) interface{}

func GetConsume

func GetConsume(ctx context.Context, channel interface{}) (interface{}, error)

func GetTopic

func GetTopic(ctx context.Context, key string) string

func InitMessenger added in v0.0.3

func InitMessenger(name string, opt MenssengerOption)

func Sent

func Sent(ctx context.Context, payload SentPayload) error

Types

type MenssengerOption

type MenssengerOption struct {
	Host      string
	Auth      bool
	Zone      string
	Username  string
	Password  string
	Topics    map[string]string
	Heartbeat int
	Active    bool
	Qos       int
}

type Messenger

type Messenger interface {
	Sent(ctx context.Context, payload SentPayload) error
	GetConnect(ctx context.Context) interface{}
	GetTopic(ctx context.Context, key string) string
	GetConsume(ctx context.Context, channel interface{}) (interface{}, error)
	GetActive(ctx context.Context) bool
}

func NewRabbit

func NewRabbit(opt MenssengerOption) Messenger

type Rabbit

type Rabbit struct {
	Connect *amqp.Connection
	Topics  map[string]string

	Active  bool
	Qos     int
	Channel *amqp.Channel
	// contains filtered or unexported fields
}

func (*Rabbit) GetActive

func (c *Rabbit) GetActive(ctx context.Context) bool

func (*Rabbit) GetConnect

func (c *Rabbit) GetConnect(ctx context.Context) interface{}

func (*Rabbit) GetConsume

func (c *Rabbit) GetConsume(ctx context.Context, channel interface{}) (interface{}, error)

func (*Rabbit) GetTopic

func (c *Rabbit) GetTopic(ctx context.Context, key string) string

func (*Rabbit) Sent

func (c *Rabbit) Sent(ctx context.Context, payload SentPayload) error

type SentPayload

type SentPayload struct {
	Topic    string
	Message  string
	Priority uint8
	Channel  interface{}
}

Jump to

Keyboard shortcuts

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