amqppublisher

package
v0.0.0-...-2ba4c8d Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL = 0
	CLOSED = 1
)

Variables

This section is empty.

Functions

func New

func New(connOpt ConnectionOption, opts ...Option) (easypubsub.Publisher, error)

Types

type ConnectionOption

type ConnectionOption func(o *connectionOptions)

func Connection

func Connection(url string) ConnectionOption

func ConnectionWithConfig

func ConnectionWithConfig(url string, amqpConfig *amqp.Config) ConnectionOption

func ConnectionWithTLS

func ConnectionWithTLS(url string, tlsConfig *tls.Config) ConnectionOption

type Exchange

type Exchange struct {
	Name       string
	Kind       string
	Durable    bool
	AutoDelete bool
	Internal   bool
	NoWait     bool
	Args       map[string]interface{}
}

type MarshalMsgFunc

type MarshalMsgFunc func(topic string, msg *easypubsub.Message, msgProps *MessageProperties) (*amqp.Publishing, error)

type MessageProperties

type MessageProperties struct {
	ContentType     string    // MIME content type
	ContentEncoding string    // MIME content encoding
	DeliveryMode    uint8     // Transient (0 or 1) or Persistent (2)
	Priority        uint8     // 0 to 9
	CorrelationId   string    // correlation identifier
	ReplyTo         string    // address to to reply to (ex: RPC)
	Expiration      string    // message expiration spec
	MessageId       string    // message identifier
	Timestamp       time.Time // message timestamp
	Type            string    // message type name
	UserId          string    // creating user id - ex: "guest"
	AppId           string    // creating application id
}

type Option

type Option func(o *options)

func WithExchange

func WithExchange(exchange *Exchange) Option

func WithLogger

func WithLogger(logger easypubsub.Logger) Option

func WithMarshalMsgFunc

func WithMarshalMsgFunc(marshalMsgFunc MarshalMsgFunc) Option

func WithMessageProperties

func WithMessageProperties(msgProps *MessageProperties) Option

func WithPublishOptions

func WithPublishOptions(publish *Publish) Option

func WithTransactional

func WithTransactional(enabled bool) Option

type Publish

type Publish struct {
	RoutingKeyFunc func(topic string) string
	Mandatory      bool
	Immediate      bool
}

type PublishResult

type PublishResult struct {
	Partition int32
	Offset    int64
}

type Publisher

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

func (*Publisher) Close

func (pub *Publisher) Close() error

func (*Publisher) Publish

func (pub *Publisher) Publish(topic string, msg *easypubsub.Message) *easypubsub.PublishResult

func (*Publisher) String

func (pub *Publisher) String() string

Jump to

Keyboard shortcuts

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