Documentation ¶
Index ¶
- Constants
- Variables
- func GetTagString(tag *string) string
- func MixTags(tags ...string) string
- func MustSetUp(c *Config, clientLogPath string, verifyConfig *VerifyConfig)
- func NewMessage(topic string, body []byte, tag *string) *rmq_client.Message
- func NewProducer() (rmq_client.Producer, error)
- func NewSimpleConsumer(consumerGroup string, ...) (rmq_client.SimpleConsumer, error)
- func SendMessage(producer rmq_client.Producer, ctx context.Context, topic string, tag *string, ...) ([]*rmq_client.SendReceipt, error)
- func SetUp(c *Config, clientLogPath string, verifyConfig *VerifyConfig) (err error)
- type Config
- type VerifyConfig
Constants ¶
View Source
const ( // DefaultAwaitDuration (Consumer)maximum waiting time for receive func DefaultAwaitDuration = time.Second * 5 // DefaultMaxMessageNum (Consumer)maximum number of messages received at one time DefaultMaxMessageNum int32 = 64 // DefaultInvisibleDuration (Consumer)should > 20s DefaultInvisibleDuration = time.Second * 20 )
Variables ¶
View Source
var (
NotSetupError = errorKit.New("Haven’t been set up correctly")
)
Functions ¶
func GetTagString ¶
func MustSetUp ¶
func MustSetUp(c *Config, clientLogPath string, verifyConfig *VerifyConfig)
func NewMessage ¶
func NewMessage(topic string, body []byte, tag *string) *rmq_client.Message
NewMessage
@param tag 可以为nil @return Producer发送的消息
func NewProducer ¶
func NewProducer() (rmq_client.Producer, error)
NewProducer
PS: (1) In most case, you don't need to create many producers, singletion pattern is more recommended. (2) 需要先 set up!!! (3) 第一个返回值,非nil的情况下,不再需要时请调用 GracefulStop().
@param clientLogPath 客户端日志(blank则输出到控制台)
func NewSimpleConsumer ¶
func NewSimpleConsumer(consumerGroup string, subscriptionExpressions map[string]*rmq_client.FilterExpression) (rmq_client.SimpleConsumer, error)
NewSimpleConsumer
PS: (1) In most case, you don't need to create many consumers, singletion pattern is more recommended. (2) 需要先 set up!!! (3) 第一个返回值,非nil的情况下,不再需要时请调用 GracefulStop().
@param consumerGroup 不能为"" @param subscriptionExpressions (1) key: topic,不能为 "*" || blank
(2) value: tag,一般为 rmq_client.SUB_ALL
@param clientLogPath 客户端日志(blank则输出到控制台)
func SendMessage ¶
func SendMessage(producer rmq_client.Producer, ctx context.Context, topic string, tag *string, body []byte, messageGroup string, deliveryTimestamp time.Time, keys ...string) ([]*rmq_client.SendReceipt, error)
SendMessage Deprecated: 仅供参考如何生产消息
Types ¶
type Config ¶
type Config struct { Endpoints []string `json:"endpoints" yaml:"endpoints" validate:"required,unique,dive,hostname_port"` Credentials *credentials.SessionCredentials `json:"credentials" yaml:"credentials"` }
type VerifyConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.