aliyunmns

package
v0.0.0-...-977fba5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package aliyunmns Message queue adapter on AliyunMNS.

Index

Constants

View Source
const (
	DefaultLoggingEnable          = true
	DefaultMaxMessageSize         = 65536
	DefaultMessageRetentionPeriod = 604800
	DefaultNotifyContentFormat    = "JSON"
	DefaultNotifyStrategy         = mns.BACKOFF_RETRY
	DefaultPollingWaitSeconds     = 30
	DefaultSlices                 = 0
	DefaultVisibilityTimeout      = 30
)

Variables

View Source
var (
	Agent AgentManager

	RegexMessageNotExist      = regexp.MustCompile(`code\s*:\s*MessageNotExist`)
	RegexQueueNotExist        = regexp.MustCompile(`code\s*:\s*QueueNotExist`)
	RegexSubscriptionNotExist = regexp.MustCompile(`code\s*:\s*SubscriptionNotExist`)
	RegexTopicNotExist        = regexp.MustCompile(`code\s*:\s*TopicNotExist`)
)
View Source
var (
	TopicMessagePool *sync.Pool
)

Functions

This section is empty.

Types

type AgentManager

type AgentManager interface {
	// Build
	// create remote relation if not exists.
	Build(ctx context.Context, task *base.Task) error

	// Destroy
	// delete remote relation if exists.
	Destroy(ctx context.Context, task *base.Task) error

	// GenQueueName
	// generate and return queue name.
	//
	//   Agent.GenQueueName(1) // return "X-Q1"
	GenQueueName(id int) string

	// GenSubscriptionName
	// generate and return subscription name.
	//
	//   Agent.GenSubscriptionName(1) // return "X-S1"
	GenSubscriptionName(id int) string

	// GenTopicName
	// generate and return topic name.
	//
	//   Agent.GenTopicName("Topic") // return "X-Topic"
	GenTopicName(name string) string

	// GetQueueClient
	// return queue client instance.
	GetQueueClient(id int) mns.AliMNSQueue

	// GetQueueManager
	// return queue manager interface.
	GetQueueManager() mns.AliQueueManager

	// GetTopicClient
	// return topic client instance.
	GetTopicClient(name string) mns.AliMNSTopic

	// GetTopicManager
	// return topic manager interface.
	GetTopicManager() mns.AliTopicManager
}

AgentManager interface of aliyunmns agent.

type Consumer

type Consumer struct {
	// contains filtered or unexported fields
}

Consumer struct for aliyun mns consumer.

func NewConsumer

func NewConsumer(id, parallel int) *Consumer

func (*Consumer) Dispatcher

func (o *Consumer) Dispatcher(v func(*base.Task, *base.Message) bool)

func (*Consumer) Processor

func (o *Consumer) Processor() process.Processor

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

Producer struct for aliyun mns producer.

func NewProducer

func NewProducer() *Producer

func (*Producer) Processor

func (o *Producer) Processor() process.Processor

func (*Producer) Publish

func (o *Producer) Publish(payload *base.Payload) (string, error)

Publish send topic message to aliyunmns.

type Remoter

type Remoter struct {
	// contains filtered or unexported fields
}

Remoter struct for aliyun mns remoter.

func NewRemoter

func NewRemoter() *Remoter

func (*Remoter) Build

func (o *Remoter) Build(ctx context.Context, task *base.Task) (err error)

func (*Remoter) BuildById

func (o *Remoter) BuildById(ctx context.Context, id int) (err error)

func (*Remoter) Destroy

func (o *Remoter) Destroy(ctx context.Context, task *base.Task) (err error)

func (*Remoter) DestroyById

func (o *Remoter) DestroyById(ctx context.Context, id int) (err error)

func (*Remoter) Processor

func (o *Remoter) Processor() process.Processor

type TopicMessage

type TopicMessage struct {
	Message   string `json:"Message"`
	MessageId string `json:"MessageId"`
	TopicName string `json:"TopicName"`
}

func (*TopicMessage) Release

func (o *TopicMessage) Release()

Jump to

Keyboard shortcuts

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