mq

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverTypeAMQP  = mqenv.DriverTypeAMQP
	DriverTypeKafka = mqenv.DriverTypeKafka

	MQTypeConsumer  = mqenv.MQTypeConsumer
	MQTypePublisher = mqenv.MQTypePublisher

	MQEventCodeOk     = mqenv.MQEventCodeOk
	MQEventCodeFailed = mqenv.MQEventCodeFailed
)

Constants

Variables

This section is empty.

Functions

func ConsumeMQ

func ConsumeMQ(mqCategory string, consumeProxy *mqenv.MQConsumerProxy) error

ConsumeMQ consume

func GetKafka

func GetKafka(name string) (*kafka.Kafka, error)

GetKafka get kafka

func GetMQRoutes

func GetMQRoutes() map[string]Config

GetMQRoutes config map

func GetRabbitMQ

func GetRabbitMQ(name string) (*rabbitmq.RabbitMQ, error)

GetRabbitMQ get rabbitmq

func Init

func Init(mqConfigFile string, mqConfigs map[string]mqenv.MQConnectorConfig) error

Init initializer

func InitMQWithRPC

func InitMQWithRPC(key string, rpcType int, connCfg *mqenv.MQConnectorConfig, mqCfg *Config) error

InitMQWithRPC init mq with RPC

func PublishMQ

func PublishMQ(mqCategory string, publishMsg *mqenv.MQPublishMessage) error

PublishMQ publish

Types

type Config

type Config struct {
	Instance string `yaml:"instance"`
	// RabbitMQ parameters
	Queue       string            `yaml:"queue"`
	Exchange    Exchange          `yaml:"exchange"`
	BindingKey  string            `yaml:"bindingKey"`
	RoutingKeys map[string]string `yaml:"routingKeys"`
	Durable     bool              `yaml:"durable"`
	RPCEnabled  bool              `yaml:"rpcEnabled"`
	// Kafka parameters
	Topic   string `yaml:"topic"`
	GroupID string `yaml:"groupId"`
}

Config struct

func GetMQConfig

func GetMQConfig(category string) *Config

GetMQConfig config

type Exchange

type Exchange struct {
	Type    string `yaml:"type"`
	Name    string `yaml:"name"`
	Durable bool   `yaml:"durable"`
}

Exchange struct

type RoutesEnv

type RoutesEnv struct {
	MQs map[string]Config `yaml:"mq"`
}

RoutesEnv struct

func InitMQRoutesEnv

func InitMQRoutesEnv(configFile string) (*RoutesEnv, error)

InitMQRoutesEnv initialize with configure file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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