mq

package
v0.20.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// Exclusive there can be only 1 consumer on the same topic with the same subscription name
	Exclusive subscriptionType = iota

	// Shared subscription mode, multiple consumer will be able to use the same subscription name
	// and the messages will be dispatched according to
	// a round-robin rotation between the connected consumers
	Shared

	// Failover subscription mode, multiple consumer will be able to use the same subscription name
	// but only 1 consumer will receive the messages.
	// If that consumer disconnects, one of the other connected consumers will start receiving messages.
	Failover

	// KeyShared subscription mode, multiple consumer will be able to use the same
	// subscription and all messages with the same key will be dispatched to only one consumer
	KeyShared
)
View Source
const (
	SERVER_URL_KEY         = "mq.service-url"
	CONNECTION_TIMEOUT_KEY = "mq.connectionTimeout"
	OPERATION_TIMEOUT_KEY  = "mq.operationTimeout"
)

Variables

This section is empty.

Functions

func DefaultSubscriptionType

func DefaultSubscriptionType() subscriptionType

Types

type ACKMode

type ACKMode uint32
const (
	ACK_AUTO ACKMode = iota
	ACK_MANUAL
)

type Client

type Client struct {
	MqClient interface{}
	AppName  string
}
var MqClient *Client

func InitClient

func InitClient(url string, connectionTimeoutSecond int64, operationTimeoutSecond int64, appName string) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Send

func (c *Client) Send(topic string, msg string) error

func (*Client) SendAsync

func (c *Client) SendAsync(topic string, msg string) error

func (*Client) SendDelay

func (c *Client) SendDelay(topic string, msg string, delay time.Duration) error

func (*Client) SendDelayAsync

func (c *Client) SendDelayAsync(topic string, msg string, delay time.Duration) error

func (*Client) SendDelayAt

func (c *Client) SendDelayAt(topic string, msg string, delayAt time.Time) error

func (*Client) SendDelayAtAsync

func (c *Client) SendDelayAtAsync(topic string, msg string, delayAt time.Time) error

func (*Client) Subscribe

func (c *Client) Subscribe(options ConsumerOptions)

func (*Client) Subscribes

func (c *Client) Subscribes(options ...ConsumerOptions)

type ConsumerOptions

type ConsumerOptions struct {
	Topic            string
	SubscriptionName string
	SubscriptionType subscriptionType
	MessageListener  consumer.Consumer
	ACKMode          ACKMode
	RetryTimes       uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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