binding

package
v0.0.0-...-becd122 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Queue      string
	Exchange   string
	RoutingKey string
	Arguments  *amqp.Table

	MatchType MatchType
	// contains filtered or unexported fields
}

Binding represents AMQP-binding

func NewBinding

func NewBinding(queue string, exchange string, routingKey string, arguments *amqp.Table, topic bool) (*Binding, error)

NewBinding returns new instance of Binding

func (*Binding) Equal

func (b *Binding) Equal(bind *Binding) bool

Equal returns is given binding equal to current with compare exchange, routing key and queue

func (*Binding) GetExchange

func (b *Binding) GetExchange() string

GetExchange returns binding's exchange

func (*Binding) GetName

func (b *Binding) GetName() string

GetName generate binding name by concatenating its params

func (*Binding) GetQueue

func (b *Binding) GetQueue() string

GetQueue returns binding's queue

func (*Binding) GetRoutingKey

func (b *Binding) GetRoutingKey() string

GetRoutingKey returns binding's routing key

func (*Binding) Marshal

func (b *Binding) Marshal(protoVersion string) (data []byte, err error)

Marshal returns raw representation of binding to store into storage

func (*Binding) MatchDirect

func (b *Binding) MatchDirect(exchange string, routingKey string) bool

MatchDirect check is message can be routed from direct-exchange to queue with compare exchange and routing key

func (*Binding) MatchFanout

func (b *Binding) MatchFanout(exchange string) bool

MatchFanout check is message can be routed from fanout-exchange to queue with compare only exchange

func (*Binding) MatchHeader

func (b *Binding) MatchHeader(exchange string, headers *amqp.Table) bool

MatchHeader checks whether the message can be routed on `b` for a header exchange type.

func (*Binding) MatchTopic

func (b *Binding) MatchTopic(exchange string, routingKey string) bool

MatchTopic check is message can be routed from topic-exchange to queue with compare exchange and match topic-pattern with routing key

func (*Binding) Unmarshal

func (b *Binding) Unmarshal(data []byte, protoVersion string) (err error)

Unmarshal returns binding from storage raw bytes data

type MatchType

type MatchType int

MatchType is the x-match attribute in a binding argument table

const (
	// MatchAll requires all registered arguments to match for routing
	MatchAll MatchType = iota
	// MatchAny requires any registered arguments to match for routing
	MatchAny
)

Jump to

Keyboard shortcuts

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