amqpmiddleware

package
v0.4.19 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package amqpmiddleware defines middleware signatures for methods on *amqp.Channel.

Using per-method middleware allows for a general system of configuring behavior across reconnection events without each feature needing to be a bespoke bit of logic spanning several methods in the Channel type.

By implementing features like consistent caller-facing delivery tags across reconnect as middleware, we can collect all logic for that feature in a single place, making the logic of the feature easier to track.

The middleware approach also makes this library highly-extensible by the end user, an added bonus.

Index

Constants

View Source
const TransportTypeChannel = "CHANNEL"

TransportTypeChannel is passed into handlers by amqp.Channel values.

View Source
const TransportTypeConnection = "CONNECTION"

TransportTypeConnection is passed into handlers by amqp.Connection values.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ack

type Ack func(next HandlerAck) HandlerAck

Ack defines signature for middleware invoked on *amqp.Channel.Ack() call.

type ArgsAck

type ArgsAck struct {
	Tag      uint64
	Multiple bool
}

ArgsAck stores args to amqp.Channel.Ack() for middleware to inspect.

type ArgsChannelReconnect

type ArgsChannelReconnect struct {
	// Ctx is the connection context.
	Ctx context.Context
	// Attempt is the reconnection attempt count. It starts at 0 when the Channel is
	// made and increments by 1 each time a reconnect is attempted. It does not reset
	// on successful reconnections.
	Attempt uint64
}

ArgsChannelReconnect passes information to HandlerChannelReconnect funcs about the reconnection event.

type ArgsClose

type ArgsClose struct {
	TransportType TransportType
}

ArgsClose stores args for the Close method on amqp.Connection and amqp.Channel.

type ArgsConfirms

type ArgsConfirms struct {
	NoWait bool
}

ArgsConfirms stores args to amqp.Channel.Confirms() for middleware to inspect.

type ArgsConnectionReconnect

type ArgsConnectionReconnect struct {
	// Ctx is the connection context.
	Ctx context.Context
	// Attempt is the reconnection attempt count. It starts at 0 when the Connection is
	// made and increments by 1 each time a reconnect is attempted. It does not reset
	// on successful reconnections.
	Attempt uint64
}

ArgsConnectionReconnect passes information to HandlerConnectionReconnect funcs about the reconnection event.

type ArgsConsume

type ArgsConsume struct {
	Queue     string
	Consumer  string
	AutoAck   bool
	Exclusive bool
	NoLocal   bool
	NoWait    bool
	Args      streadway.Table
}

ArgsConsume stores args to amqp.Channel.Consume() for middleware to inspect.

type ArgsExchangeBind

type ArgsExchangeBind struct {
	Destination string
	Key         string
	Source      string
	NoWait      bool
	Args        streadway.Table
}

ArgsExchangeBind stores args to amqp.Channel.ExchangeBind() for middleware to inspect.

type ArgsExchangeDeclare

type ArgsExchangeDeclare struct {
	Name       string
	Kind       string
	Durable    bool
	AutoDelete bool
	Internal   bool
	NoWait     bool
	Args       streadway.Table
}

ArgsExchangeDeclare stores args to amqp.Channel.ExchangeDeclare() for middleware to inspect.

type ArgsExchangeDelete

type ArgsExchangeDelete struct {
	Name     string
	IfUnused bool
	NoWait   bool
}

ArgsExchangeDelete stores args to amqp.Channel.ExchangeDelete() for middleware to inspect.

type ArgsExchangeUnbind

type ArgsExchangeUnbind struct {
	Destination string
	Key         string
	Source      string
	NoWait      bool
	Args        streadway.Table
}

ArgsExchangeUnbind stores args to amqp.Channel.ExchangeUnbind() for middleware to inspect.

type ArgsFlow

type ArgsFlow struct {
	Active bool
}

ArgsFlow stores args to amqp.Channel.Flow() for middleware to inspect.

type ArgsGet

type ArgsGet struct {
	Queue   string
	AutoAck bool
}

ArgsGet stores args to amqp.Channel.Get() for middleware to inspect.

type ArgsNack

type ArgsNack struct {
	Tag      uint64
	Multiple bool
	Requeue  bool
}

ArgsNack stores args to amqp.Channel.Nack() for middleware to inspect.

type ArgsNotifyCancel

type ArgsNotifyCancel struct {
	Cancellations chan string
}

ArgsNotifyCancel stores the args to amqp.Channel.NotifyCancel for middleware to inspect.

type ArgsNotifyClose

type ArgsNotifyClose struct {
	TransportType TransportType
	Receiver      chan *streadway.Error
}

ArgsNotifyClose stores args for the NotifyClose method on amqp.Connection and amqp.Channel.

type ArgsNotifyConfirm

type ArgsNotifyConfirm struct {
	Ack  chan uint64
	Nack chan uint64
}

ArgsNotifyConfirm stores args to amqp.Channel.NotifyConfirm() for middleware to inspect.

type ArgsNotifyConfirmOrOrphaned

type ArgsNotifyConfirmOrOrphaned struct {
	Ack      chan uint64
	Nack     chan uint64
	Orphaned chan uint64
}

ArgsNotifyConfirmOrOrphaned stores args to amqp.Channel.NotifyConfirmOrOrphaned() for middleware to inspect.

type ArgsNotifyDial

type ArgsNotifyDial struct {
	TransportType TransportType
	Receiver      chan error
}

ArgsNotifyDial stores args for the NotifyDial method on amqp.Connection and amqp.Channel.

type ArgsNotifyDisconnect

type ArgsNotifyDisconnect struct {
	TransportType TransportType
	Receiver      chan error
}

ArgsNotifyDisconnect stores args for the NotifyDisconnect method on amqp.Connection and amqp.Channel.

type ArgsNotifyFlow

type ArgsNotifyFlow struct {
	FlowNotifications chan bool
}

ArgsNotifyFlow stores the args to amqp.Channel.NotifyFlow for middleware to inspect.

type ArgsNotifyPublish

type ArgsNotifyPublish struct {
	Confirm chan internal.Confirmation
}

ArgsNotifyPublish stores args to amqp.Channel.NotifyPublish() for middleware to inspect.

type ArgsNotifyReturn

type ArgsNotifyReturn struct {
	Returns chan streadway.Return
}

ArgsNotifyReturn stores the args to amqp.Channel.NotifyReturn for middleware to inspect.

type ArgsPublish

type ArgsPublish struct {
	Exchange  string
	Key       string
	Mandatory bool
	Immediate bool
	Msg       streadway.Publishing
}

ArgsPublish stores args to amqp.Channel.Publish() for middleware to inspect.

type ArgsQoS

type ArgsQoS struct {
	PrefetchCount int
	PrefetchSize  int
	Global        bool
}

ArgsQoS stores args to amqp.Channel.QoS() for middleware to inspect.

type ArgsQueueBind

type ArgsQueueBind struct {
	Name     string
	Key      string
	Exchange string
	NoWait   bool
	Args     streadway.Table
}

ArgsQueueBind stores args to amqp.Channel.QueueBind() for middleware to inspect.

type ArgsQueueDeclare

type ArgsQueueDeclare struct {
	Name       string
	Durable    bool
	AutoDelete bool
	Exclusive  bool
	NoWait     bool
	Args       streadway.Table
}

ArgsQueueDeclare stores args to amqp.Channel.QueueDeclare() for middleware to inspect.

type ArgsQueueDelete

type ArgsQueueDelete struct {
	Name     string
	IfUnused bool
	IfEmpty  bool
	NoWait   bool
}

ArgsQueueDelete stores args to amqp.Channel.QueueDelete() for middleware to inspect.

type ArgsQueueInspect

type ArgsQueueInspect struct {
	Name string
}

ArgsQueueInspect stores args to amqp.Channel.QueueInspect() for middleware to inspect.

type ArgsQueuePurge

type ArgsQueuePurge struct {
	Name   string
	NoWait bool
}

ArgsQueuePurge stores args to amqp.Channel.QueuePurge() for middleware to inspect.

type ArgsQueueUnbind

type ArgsQueueUnbind struct {
	Name     string
	Key      string
	Exchange string
	Args     streadway.Table
}

ArgsQueueUnbind stores args to amqp.Channel.QueueUnbind() for middleware to inspect.

type ArgsReject

type ArgsReject struct {
	Tag     uint64
	Requeue bool
}

ArgsReject stores args to amqp.Channel.Reject() for middleware to inspect.

type ChannelReconnect

type ChannelReconnect = func(next HandlerChannelReconnect) HandlerChannelReconnect

ChannelReconnect defines signature for middleware called on underlying channel reconnection event.

type Close

type Close func(next HandlerClose) HandlerClose

Close defines signature for middleware invoked on the Close method of an amqp.Connection or amqp.Channel.

type Confirm

type Confirm func(next HandlerConfirm) HandlerConfirm

Confirm defines signature for middleware invoked on *amqp.Channel.Confirm() call.

type ConnectionReconnect

type ConnectionReconnect = func(next HandlerConnectionReconnect) HandlerConnectionReconnect

ConnectionReconnect defines signature for middleware called on underlying channel reconnection event.

type Consume

type Consume func(next HandlerConsume) HandlerConsume

Consume defines signature for middleware invoked on *amqp.Channel.Get() call.

type ConsumeEvents

type ConsumeEvents func(next HandlerConsumeEvents) HandlerConsumeEvents

ConsumeEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.Consume() events.

type EventConsume

type EventConsume struct {
	Delivery internal.Delivery
}

EventConsume passes event information from an amqp.Channel.Consume() event for middleware to inspect / modify before the event is passed to the caller.

type EventInfo

type EventInfo struct {
	// EventNum is the event number starting at 0. For Relays, this value will reset
	// each leg. -1 if unknown.
	EventNum int64
	// RelayLeg is the leg of the relay we are on. Each time a connection is
	// re-established, we hit a new relay "leg".
	//
	// -1 if this event feed does not pull directly from an underlying connection, and
	// therefore does not have a "LEG"
	RelayLeg int
}

EventInfo is information provided from the base library that can be extracted from EventMetadata.

func GetEventInfo

func GetEventInfo(metadata EventMetadata) (info EventInfo)

GetEventInfo extracts EventInfo from EventMetadata.

type EventMetadata

type EventMetadata map[MetadataKey]interface{}

EventMetadata is metadata passed into an event handler. Events cannot be cancelled, and therefore do not have contexts, so middleware-centric metadata should be added to and fetched from this argument.

func (EventMetadata) GetKey

func (metadata EventMetadata) GetKey(key MetadataKey) interface{}

GetKey gets key from metadata. Returns nil if key could not be found

type EventNotifyCancel

type EventNotifyCancel struct {
	Cancellation string
}

EventNotifyCancel passes event information from an amqp.Channel.NotifyCancel() event for middleware to inspect / modify before the event is passed to the caller.

type EventNotifyClose

type EventNotifyClose struct {
	TransportType TransportType
	Err           *streadway.Error
}

EventNotifyClose passes event information from a NotifyClose event on an amqp.Connection or amqp.Channel.

type EventNotifyConfirm

type EventNotifyConfirm struct {
	// Confirmation is the underlying confirmation event being distributed to the
	// caller channels
	Confirmation internal.Confirmation
}

EventNotifyConfirm passes event information from an amqp.Channel.NotifyConfirm() event for middleware to inspect / modify before the event is passed to the caller.

type EventNotifyConfirmOrOrphaned

type EventNotifyConfirmOrOrphaned struct {
	// Confirmation is the underlying confirmation event being distributed to the
	// caller channels
	Confirmation internal.Confirmation
}

EventNotifyConfirmOrOrphaned passes event information from an amqp.Channel.NotifyConfirmOrOrphaned() event for middleware to inspect / modify before the event is passed to the caller.

type EventNotifyDial

type EventNotifyDial struct {
	TransportType TransportType
	Err           error
}

EventNotifyDial passes event information from a NotifyDial event on an amqp.Connection or amqp.Channel.

type EventNotifyDisconnect

type EventNotifyDisconnect struct {
	TransportType TransportType
	Err           error
}

EventNotifyDisconnect passes event information from a NotifyDisconnect event on an amqp.Connection or amqp.Channel.

type EventNotifyFlow

type EventNotifyFlow struct {
	FlowNotification bool
}

EventNotifyFlow passes event information from an amqp.Channel.NotifyFlow() event for middleware to inspect / modify before the event is passed to the caller.

type EventNotifyPublish

type EventNotifyPublish struct {
	Confirmation internal.Confirmation
}

EventNotifyPublish passes event information from an amqp.Channel.NotifyPublish() event for middleware to inspect / modify before the event is passed to the caller.

type EventNotifyReturn

type EventNotifyReturn struct {
	Return streadway.Return
}

EventNotifyReturn passes event information from an amqp.Channel.NotifyReturn() event for middleware to inspect / modify before the event is passed to the caller.

type ExchangeBind

type ExchangeBind func(next HandlerExchangeBind) HandlerExchangeBind

ExchangeBind defines signature for middleware invoked on *amqp.Channel.ExchangeBind() call.

type ExchangeDeclare

type ExchangeDeclare func(next HandlerExchangeDeclare) HandlerExchangeDeclare

ExchangeDeclare defines signature for middleware invoked on *amqp.Channel.ExchangeDeclare() call.

type ExchangeDelete

type ExchangeDelete func(next HandlerExchangeDelete) HandlerExchangeDelete

ExchangeDelete defines signature for middleware invoked on *amqp.Channel.ExchangeDelete() call.

type ExchangeUnbind

type ExchangeUnbind func(next HandlerExchangeUnbind) HandlerExchangeUnbind

ExchangeUnbind defines signature for middleware invoked on *amqp.Channel.ExchangeUnbind() call.

type Flow

type Flow func(next HandlerFlow) HandlerFlow

Flow defines signature for middleware invoked on *amqp.Channel.Flow() call.

type Get

type Get func(next HandlerGet) HandlerGet

Get defines signature for middleware invoked on *amqp.Channel.Get() call.

type HandlerAck

type HandlerAck func(ctx context.Context, args ArgsAck) error

HandlerAck is the signature for handlers invoked when amqp.Channel.Ack is called.

type HandlerChannelReconnect

type HandlerChannelReconnect = func(ctx context.Context, args ArgsChannelReconnect) (ResultsChannelReconnect, error)

HandlerChannelReconnect is the signature for handlers triggered when a channel is being re-established.

Attempt is the attempt number, including all previous failures and successes.

type HandlerClose

type HandlerClose func(ctx context.Context, args ArgsClose) error

HandlerClose is the signature for handlers invoked when the Close method is called on an amqp.Connection or amqp.Channel.

type HandlerConfirm

type HandlerConfirm func(ctx context.Context, args ArgsConfirms) error

HandlerConfirm is the signature for handlers invoked when amqp.Channel.Confirm is called.

type HandlerConnectionReconnect

type HandlerConnectionReconnect = func(
	ctx context.Context, args ArgsConnectionReconnect,
) (ResultsConnectionReconnect, error)

HandlerConnectionReconnect is the signature for handlers triggered when a channel is being re-established.

Attempt is the attempt number, including all previous failures and successes.

type HandlerConsume

type HandlerConsume func(ctx context.Context, args ArgsConsume) (results ResultsConsume, err error)

HandlerConsume is the signature for handlers invoked when amqp.Channel.Consume is called.

NOTE: this is separate from HandlerConsumeEvents, which handles each event. This handler only fires on the initial call

type HandlerConsumeEvents

type HandlerConsumeEvents func(metadata EventMetadata, event EventConsume)

HandlerConsumeEvents is the signature for handlers invoked when an event from an amqp.Channel.Consume is being processed before being sent to the caller.

type HandlerExchangeBind

type HandlerExchangeBind func(ctx context.Context, args ArgsExchangeBind) error

HandlerExchangeBind is the signature for handlers invoked when amqp.Channel.ExchangeBind is called.

type HandlerExchangeDeclare

type HandlerExchangeDeclare = func(ctx context.Context, args ArgsExchangeDeclare) error

HandlerExchangeDeclare is the signature for handlers invoked when amqp.Channel.ExchangeDeclare is called.

type HandlerExchangeDelete

type HandlerExchangeDelete func(ctx context.Context, args ArgsExchangeDelete) error

HandlerExchangeDelete is the signature for handlers invoked when amqp.Channel.ExchangeDelete is called.

type HandlerExchangeUnbind

type HandlerExchangeUnbind func(ctx context.Context, args ArgsExchangeUnbind) error

HandlerExchangeUnbind is the signature for handlers invoked when amqp.Channel.ExchangeUnbind is called.

type HandlerFlow

type HandlerFlow func(ctx context.Context, args ArgsFlow) error

HandlerFlow is the signature for handlers invoked when amqp.Channel.Flow is called.

type HandlerGet

type HandlerGet func(ctx context.Context, args ArgsGet) (results ResultsGet, err error)

HandlerGet is the signature for handlers invoked when amqp.Channel.Get is called.

type HandlerNack

type HandlerNack func(ctx context.Context, args ArgsNack) error

HandlerNack is the signature for handlers invoked when amqp.Channel.Nack is called.

type HandlerNotifyCancel

type HandlerNotifyCancel func(ctx context.Context, args ArgsNotifyCancel) ResultsNotifyCancel

HandlerNotifyCancel signature for handlers invoked when amqp.Channel.NotifyReturn is called.

type HandlerNotifyCancelEvents

type HandlerNotifyCancelEvents func(metadata EventMetadata, event EventNotifyCancel)

HandlerNotifyCancelEvents is the signature for handlers invoked when an event from an amqp.Channel.NotifyReturn is being processed before being sent to the caller.

type HandlerNotifyClose

type HandlerNotifyClose func(ctx context.Context, args ArgsNotifyClose) ResultsNotifyClose

HandlerNotifyClose is the signature for handlers invoked when the NotifyClose method is called on an amqp.Connection or amqp.Channel.

type HandlerNotifyCloseEvents

type HandlerNotifyCloseEvents func(metadata EventMetadata, event EventNotifyClose)

HandlerNotifyCloseEvents is the signature for handlers invoked when an event from a NotifyClose of an amqp.Connection or amqp.Channel is being processed before being sent to the caller.

type HandlerNotifyConfirm

type HandlerNotifyConfirm func(ctx context.Context, args ArgsNotifyConfirm) ResultsNotifyConfirm

HandlerNotifyConfirm is the signature for handlers invoked when amqp.Channel.NotifyConfirm is called.

type HandlerNotifyConfirmEvents

type HandlerNotifyConfirmEvents func(metadata EventMetadata, event EventNotifyConfirm)

HandlerNotifyConfirmEvents is the signature for handlers invoked when an event from an amqp.Channel.NotifyConfirm is being processed before being sent to the caller.

type HandlerNotifyConfirmOrOrphaned

type HandlerNotifyConfirmOrOrphaned func(
	ctx context.Context, args ArgsNotifyConfirmOrOrphaned,
) ResultsNotifyConfirmOrOrphaned

HandlerNotifyConfirmOrOrphaned is the signature for handlers invoked when amqp.Channel.NotifyConfirmOrOrphaned is called.

type HandlerNotifyConfirmOrOrphanedEvents

type HandlerNotifyConfirmOrOrphanedEvents func(metadata EventMetadata, event EventNotifyConfirmOrOrphaned)

HandlerNotifyConfirmOrOrphanedEvents is the signature for handlers invoked when an event from ab amqp.Channel.NotifyConfirmOrOrphaned is being processed before being sent to the caller.

type HandlerNotifyDial

type HandlerNotifyDial func(ctx context.Context, args ArgsNotifyDial) error

HandlerNotifyDial is the signature for handlers invoked when the NotifyDial method is called on an amqp.Connection or amqp.Channel.

type HandlerNotifyDialEvents

type HandlerNotifyDialEvents func(metadata EventMetadata, event EventNotifyDial)

HandlerNotifyDialEvents is the signature for handlers invoked when an event from a NotifyDial of an amqp.Connection or amqp.Channel is being processed before being sent to the caller.

type HandlerNotifyDisconnect

type HandlerNotifyDisconnect func(ctx context.Context, args ArgsNotifyDisconnect) error

HandlerNotifyDisconnect is the signature for handlers invoked when the NotifyDisconnect method is called on an amqp.Connection or amqp.Channel.

type HandlerNotifyDisconnectEvents

type HandlerNotifyDisconnectEvents func(metadata EventMetadata, event EventNotifyDisconnect)

HandlerNotifyDisconnectEvents is the signature for handlers invoked when an event from a NotifyDisconnect of an amqp.Connection or amqp.Channel is being processed before being sent to the caller.

type HandlerNotifyFlow

type HandlerNotifyFlow func(ctx context.Context, args ArgsNotifyFlow) ResultsNotifyFlow

HandlerNotifyFlow signature for handlers invoked when amqp.Channel.NotifyFlow is called.

type HandlerNotifyFlowEvents

type HandlerNotifyFlowEvents func(metadata EventMetadata, event EventNotifyFlow)

HandlerNotifyFlowEvents is the signature for handlers invoked when an event from an amqp.Channel.NotifyFlow is being processed before being sent to the caller.

type HandlerNotifyPublish

type HandlerNotifyPublish func(ctx context.Context, args ArgsNotifyPublish) ResultsNotifyPublish

HandlerNotifyPublish is the signature for handlers invoked when amqp.Channel.NotifyPublish is called.

type HandlerNotifyPublishEvents

type HandlerNotifyPublishEvents func(metadata EventMetadata, event EventNotifyPublish)

HandlerNotifyPublishEvents is the signature for handlers invoked when an event from an amqp.Channel.NotifyPublish is being processed before being sent to the caller.

type HandlerNotifyReturn

type HandlerNotifyReturn func(ctx context.Context, args ArgsNotifyReturn) ResultsNotifyReturn

HandlerNotifyReturn signature for handlers invoked when amqp.Channel.NotifyReturn is called.

type HandlerNotifyReturnEvents

type HandlerNotifyReturnEvents func(metadata EventMetadata, event EventNotifyReturn)

HandlerNotifyReturnEvents is the signature for handlers invoked when an event from an amqp.Channel.NotifyReturn is being processed before being sent to the caller.

type HandlerPublish

type HandlerPublish func(ctx context.Context, args ArgsPublish) error

HandlerPublish is the signature for handlers invoked when amqp.Channel.Publish is called.

type HandlerQoS

type HandlerQoS func(ctx context.Context, args ArgsQoS) error

HandlerQoS is the signature for handlers invoked when amqp.Channel.QoS is called.

type HandlerQueueBind

type HandlerQueueBind = func(ctx context.Context, args ArgsQueueBind) error

HandlerQueueBind is the signature for handlers invoked when amqp.Channel.QueueBind is called.

type HandlerQueueDeclare

type HandlerQueueDeclare = func(ctx context.Context, args ArgsQueueDeclare) (ResultsQueueDeclare, error)

HandlerQueueDeclare is the signature for handlers invoked when amqp.Channel.QueueDeclare is called.

type HandlerQueueDelete

type HandlerQueueDelete = func(ctx context.Context, args ArgsQueueDelete) (ResultsQueueDelete, error)

HandlerQueueDelete is the signature for handlers invoked when amqp.Channel.QueueDelete is called.

type HandlerQueueInspect

type HandlerQueueInspect = func(ctx context.Context, args ArgsQueueInspect) (ResultsQueueInspect, error)

HandlerQueueInspect is the signature for handlers invoked when amqp.Channel.QueueDeclare is called.

type HandlerQueuePurge

type HandlerQueuePurge = func(ctx context.Context, args ArgsQueuePurge) (ResultsQueuePurge, error)

HandlerQueuePurge is the signature for handlers invoked when amqp.Channel.QueuePurge is called.

type HandlerQueueUnbind

type HandlerQueueUnbind = func(ctx context.Context, args ArgsQueueUnbind) error

HandlerQueueUnbind is the signature for handlers invoked when amqp.Channel.QueueUnbind is called.

type HandlerReject

type HandlerReject func(ctx context.Context, args ArgsReject) error

HandlerReject is the signature for handlers invoked when amqp.Channel.Reject is called.

type MetadataKey added in v0.4.2

type MetadataKey string

MetadataKey is used to store and fetch values on a context.Context amqpmiddleware.EventMetadata.

type MethodInfo

type MethodInfo struct {
	// OpAttempt: Some operations retry over disconnections. This is the attempt number,
	// starting at 0. Will be -1 if this is not an operation that is re-tried.
	OpAttempt int
}

MethodInfo holds extracted information from the context passed into a method handler.

func GetMethodInfo

func GetMethodInfo(ctx context.Context) (info MethodInfo)

GetMethodInfo extracts context info from a middleware context.

type Nack

type Nack func(next HandlerNack) HandlerNack

Nack defines signature for middleware invoked on *amqp.Channel.Nack() call.

type NotifyCancel

type NotifyCancel func(next HandlerNotifyCancel) HandlerNotifyCancel

NotifyCancel defines signature for middleware invoked on *amqp.Channel.NotifyCancel() call.

type NotifyCancelEvents

type NotifyCancelEvents func(next HandlerNotifyCancelEvents) HandlerNotifyCancelEvents

NotifyCancelEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyCancel() events.

type NotifyClose

type NotifyClose func(next HandlerNotifyClose) HandlerNotifyClose

NotifyClose defines signature for middleware invoked on the NotifyClose method of an amqp.Connection or amqp.Channel.

type NotifyCloseEvents

type NotifyCloseEvents func(next HandlerNotifyCloseEvents) HandlerNotifyCloseEvents

NotifyCloseEvents defines signature for middleware invoked on event processed during relay of NotifyClose() events on either an amqp.Connection or amqp.Channel.

type NotifyConfirm

type NotifyConfirm func(next HandlerNotifyConfirm) HandlerNotifyConfirm

NotifyConfirm defines signature for middleware invoked on *amqp.Channel.NotifyConfirm() call.

type NotifyConfirmEvents

type NotifyConfirmEvents func(next HandlerNotifyConfirmEvents) HandlerNotifyConfirmEvents

NotifyConfirmEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyConfirm() events.

type NotifyConfirmOrOrphaned

type NotifyConfirmOrOrphaned func(next HandlerNotifyConfirmOrOrphaned) HandlerNotifyConfirmOrOrphaned

NotifyConfirmOrOrphaned defines signature for middleware invoked on *amqp.Channel.NotifyConfirmOrOrphaned() call.

type NotifyConfirmOrOrphanedEvents

type NotifyConfirmOrOrphanedEvents func(next HandlerNotifyConfirmOrOrphanedEvents) HandlerNotifyConfirmOrOrphanedEvents

NotifyConfirmOrOrphanedEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyConfirmOrOrphaned() events.

type NotifyDial

type NotifyDial func(next HandlerNotifyDial) HandlerNotifyDial

NotifyDial defines signature for middleware invoked on the NotifyDial method of an amqp.Connection or amqp.Channel.

type NotifyDialEvents

type NotifyDialEvents func(next HandlerNotifyDialEvents) HandlerNotifyDialEvents

NotifyDialEvents defines signature for middleware invoked on event processed during relay of NotifyConnect() events on either an amqp.Connection or amqp.Channel.

type NotifyDisconnect

type NotifyDisconnect func(next HandlerNotifyDisconnect) HandlerNotifyDisconnect

NotifyDisconnect defines signature for middleware invoked on the NotifyDisconnect method of an amqp.Connection or amqp.Channel.

type NotifyDisconnectEvents

type NotifyDisconnectEvents func(next HandlerNotifyDisconnectEvents) HandlerNotifyDisconnectEvents

NotifyDisconnectEvents defines signature for middleware invoked on event processed during relay of NotifyDisconnect() events on either an amqp.Connection or amqp.Channel.

type NotifyFlow

type NotifyFlow func(next HandlerNotifyFlow) HandlerNotifyFlow

NotifyFlow defines signature for middleware invoked on *amqp.Channel.NotifyFlow() call.

type NotifyFlowEvents

type NotifyFlowEvents func(next HandlerNotifyFlowEvents) HandlerNotifyFlowEvents

NotifyFlowEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyFlow() events.

type NotifyPublish

type NotifyPublish func(next HandlerNotifyPublish) HandlerNotifyPublish

NotifyPublish defines signature for middleware invoked on *amqp.Channel.NotifyPublish() call.

type NotifyPublishEvents

type NotifyPublishEvents func(next HandlerNotifyPublishEvents) HandlerNotifyPublishEvents

NotifyPublishEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyPublish() events.

type NotifyReturn

type NotifyReturn func(next HandlerNotifyReturn) HandlerNotifyReturn

NotifyReturn defines signature for middleware invoked on *amqp.Channel.NotifyReturn() call.

type NotifyReturnEvents

type NotifyReturnEvents func(next HandlerNotifyReturnEvents) HandlerNotifyReturnEvents

NotifyReturnEvents defines signature for middleware invoked on event processed during relay of *amqp.Channel.NotifyReturn() events.

type ProviderFactory

type ProviderFactory = func() ProvidesMiddleware

ProviderFactory is a function that creates a fresh instance of a middleware provider.

type ProviderTypeID

type ProviderTypeID string

ProviderTypeID identifies a provider type to avoid double registration and support fetching middleware providers during tests.

type ProvidesAck

type ProvidesAck interface {
	ProvidesMiddleware
	Ack(next HandlerAck) HandlerAck
}

ProvidesAck provides Ack as a method.

type ProvidesAllConnection

type ProvidesAllConnection interface {
	ProvidesAllShared
	ProvidesConnectionReconnect
}

ProvidesAllConnection is a convenience interface for generating middleware providers that implement all Connection middleware providers interfaces.

type ProvidesAllMiddleware

type ProvidesAllMiddleware interface {
	ProvidesAllConnection
	ProvidesAllChannel
}

ProvidesAllMiddleware is a convenience interface for generating middleware providers that implement all Connection and Channel middleware provider interfaces.

type ProvidesAllShared

ProvidesAllShared is a convenience interface for generating middleware providers that implement all shared methods between Connection and Channel middleware provider interfaces.

type ProvidesChannelReconnect

type ProvidesChannelReconnect interface {
	ProvidesMiddleware
	ChannelReconnect(next HandlerChannelReconnect) HandlerChannelReconnect
}

ProvidesChannelReconnect provides ChannelReconnect as a method.

type ProvidesClose

type ProvidesClose interface {
	ProvidesMiddleware
	Close(next HandlerClose) HandlerClose
}

ProvidesClose provides Close as a method.

type ProvidesConfirm

type ProvidesConfirm interface {
	ProvidesMiddleware
	Confirm(next HandlerConfirm) HandlerConfirm
}

ProvidesConfirm provides Confirm as a method.

type ProvidesConnectionReconnect

type ProvidesConnectionReconnect interface {
	ProvidesMiddleware
	ConnectionReconnect(next HandlerConnectionReconnect) HandlerConnectionReconnect
}

ProvidesConnectionReconnect provides ConnectionReconnect as a method.

type ProvidesConsume

type ProvidesConsume interface {
	ProvidesMiddleware
	Consume(next HandlerConsume) HandlerConsume
}

ProvidesConsume provides Consume as a method.

type ProvidesConsumeEvents

type ProvidesConsumeEvents interface {
	ProvidesMiddleware
	ConsumeEvents(next HandlerConsumeEvents) HandlerConsumeEvents
}

ProvidesConsumeEvents provides ConsumeEvents as a method.

type ProvidesExchangeBind

type ProvidesExchangeBind interface {
	ProvidesMiddleware
	ExchangeBind(next HandlerExchangeBind) HandlerExchangeBind
}

ProvidesExchangeBind provides ExchangeBind as a method.

type ProvidesExchangeDeclare

type ProvidesExchangeDeclare interface {
	ProvidesMiddleware
	ExchangeDeclare(next HandlerExchangeDeclare) HandlerExchangeDeclare
}

ProvidesExchangeDeclare provides ExchangeDeclare as a method.

type ProvidesExchangeDeclarePassive

type ProvidesExchangeDeclarePassive interface {
	ProvidesMiddleware
	ExchangeDeclarePassive(next HandlerExchangeDeclare) HandlerExchangeDeclare
}

ProvidesExchangeDeclarePassive provides ExchangeDeclarePassive as a method.

type ProvidesExchangeDelete

type ProvidesExchangeDelete interface {
	ProvidesMiddleware
	ExchangeDelete(next HandlerExchangeDelete) HandlerExchangeDelete
}

ProvidesExchangeDelete provides ExchangeDelete as a method.

type ProvidesExchangeUnbind

type ProvidesExchangeUnbind interface {
	ProvidesMiddleware
	ExchangeUnbind(next HandlerExchangeUnbind) HandlerExchangeUnbind
}

ProvidesExchangeUnbind provides ExchangeUnbind as a method.

type ProvidesFlow

type ProvidesFlow interface {
	ProvidesMiddleware
	Flow(next HandlerFlow) HandlerFlow
}

ProvidesFlow provides Flow as a method.

type ProvidesGet

type ProvidesGet interface {
	ProvidesMiddleware
	Get(next HandlerGet) HandlerGet
}

ProvidesGet provides Get as a method.

type ProvidesMiddleware

type ProvidesMiddleware interface {
	// ProviderTypeID is an ID for the provider type, so the instance of the provider
	// can be retrieved and inspected during testing.
	TypeID() ProviderTypeID
}

ProvidesMiddleware must be implemented by any middleware provider type. Provider types expose methods which implement Connection or Channel middleware and can be useful for creating complex middlewares that interact with multiple methods.

The DialConfig type has helper methods on it's Middleware configuration fields for automatically registering ProviderMethods as middleware without having to do so by hand.

type ProvidesNack

type ProvidesNack interface {
	ProvidesMiddleware
	Nack(next HandlerNack) HandlerNack
}

ProvidesNack provides Nack as a method.

type ProvidesNotifyCancel

type ProvidesNotifyCancel interface {
	ProvidesMiddleware
	NotifyCancel(next HandlerNotifyCancel) HandlerNotifyCancel
}

ProvidesNotifyCancel provides NotifyCancel as a method.

type ProvidesNotifyCancelEvents

type ProvidesNotifyCancelEvents interface {
	ProvidesMiddleware
	NotifyCancelEvents(next HandlerNotifyCancelEvents) HandlerNotifyCancelEvents
}

ProvidesNotifyCancelEvents provides NotifyCancelEvents as a method.

type ProvidesNotifyClose

type ProvidesNotifyClose interface {
	ProvidesMiddleware
	NotifyClose(next HandlerNotifyClose) HandlerNotifyClose
}

ProvidesNotifyClose provides NotifyClose as a method.

type ProvidesNotifyCloseEvents

type ProvidesNotifyCloseEvents interface {
	ProvidesMiddleware
	NotifyCloseEvents(next HandlerNotifyCloseEvents) HandlerNotifyCloseEvents
}

ProvidesNotifyCloseEvents provides NotifyCloseEvents as a method.

type ProvidesNotifyConfirm

type ProvidesNotifyConfirm interface {
	ProvidesMiddleware
	NotifyConfirm(next HandlerNotifyConfirm) HandlerNotifyConfirm
}

ProvidesNotifyConfirm provides NotifyConfirm as a method.

type ProvidesNotifyConfirmEvents

type ProvidesNotifyConfirmEvents interface {
	ProvidesMiddleware
	NotifyConfirmEvents(next HandlerNotifyConfirmEvents) HandlerNotifyConfirmEvents
}

ProvidesNotifyConfirmEvents provides NotifyConfirmEvents as a method.

type ProvidesNotifyConfirmOrOrphaned

type ProvidesNotifyConfirmOrOrphaned interface {
	ProvidesMiddleware
	NotifyConfirmOrOrphaned(next HandlerNotifyConfirmOrOrphaned) HandlerNotifyConfirmOrOrphaned
}

ProvidesNotifyConfirmOrOrphaned provides NotifyConfirmOrOrphaned as a method.

type ProvidesNotifyConfirmOrOrphanedEvents

type ProvidesNotifyConfirmOrOrphanedEvents interface {
	ProvidesMiddleware
	NotifyConfirmOrOrphanedEvents(next HandlerNotifyConfirmOrOrphanedEvents) HandlerNotifyConfirmOrOrphanedEvents
}

ProvidesNotifyConfirmOrOrphanedEvents provides NotifyConfirmOrOrphanedEvents as a method.

type ProvidesNotifyDial

type ProvidesNotifyDial interface {
	ProvidesMiddleware
	NotifyDial(next HandlerNotifyDial) HandlerNotifyDial
}

ProvidesNotifyDial provides NotifyDial as a method.

type ProvidesNotifyDialEvents

type ProvidesNotifyDialEvents interface {
	ProvidesMiddleware
	NotifyDialEvents(next HandlerNotifyDialEvents) HandlerNotifyDialEvents
}

ProvidesNotifyDialEvents provides NotifyDialEvents as a method.

type ProvidesNotifyDisconnect

type ProvidesNotifyDisconnect interface {
	ProvidesMiddleware
	NotifyDisconnect(next HandlerNotifyDisconnect) HandlerNotifyDisconnect
}

ProvidesNotifyDisconnect provides NotifyDisconnect as a method.

type ProvidesNotifyDisconnectEvents

type ProvidesNotifyDisconnectEvents interface {
	ProvidesMiddleware
	NotifyDisconnectEvents(next HandlerNotifyDisconnectEvents) HandlerNotifyDisconnectEvents
}

ProvidesNotifyDisconnectEvents provides NotifyDisconnectEvents as a method.

type ProvidesNotifyFlow

type ProvidesNotifyFlow interface {
	ProvidesMiddleware
	NotifyFlow(next HandlerNotifyFlow) HandlerNotifyFlow
}

ProvidesNotifyFlow provides NotifyFlow as a method.

type ProvidesNotifyFlowEvents

type ProvidesNotifyFlowEvents interface {
	ProvidesMiddleware
	NotifyFlowEvents(next HandlerNotifyFlowEvents) HandlerNotifyFlowEvents
}

ProvidesNotifyFlowEvents provides NotifyCancelEvents as a method.

type ProvidesNotifyPublish

type ProvidesNotifyPublish interface {
	ProvidesMiddleware
	NotifyPublish(next HandlerNotifyPublish) HandlerNotifyPublish
}

ProvidesNotifyPublish provides NotifyPublish as a method.

type ProvidesNotifyPublishEvents

type ProvidesNotifyPublishEvents interface {
	ProvidesMiddleware
	NotifyPublishEvents(next HandlerNotifyPublishEvents) HandlerNotifyPublishEvents
}

ProvidesNotifyPublishEvents provides NotifyPublishEvents as a method.

type ProvidesNotifyReturn

type ProvidesNotifyReturn interface {
	ProvidesMiddleware
	NotifyReturn(next HandlerNotifyReturn) HandlerNotifyReturn
}

ProvidesNotifyReturn provides NotifyReturn as a method.

type ProvidesNotifyReturnEvents

type ProvidesNotifyReturnEvents interface {
	ProvidesMiddleware
	NotifyReturnEvents(next HandlerNotifyReturnEvents) HandlerNotifyReturnEvents
}

ProvidesNotifyReturnEvents provides NotifyReturnEvents as a method.

type ProvidesPublish

type ProvidesPublish interface {
	ProvidesMiddleware
	Publish(next HandlerPublish) HandlerPublish
}

ProvidesPublish provides Publish as a method.

type ProvidesQoS

type ProvidesQoS interface {
	ProvidesMiddleware
	QoS(next HandlerQoS) HandlerQoS
}

ProvidesQoS provides QoS as a method.

type ProvidesQueueBind

type ProvidesQueueBind interface {
	ProvidesMiddleware
	QueueBind(next HandlerQueueBind) HandlerQueueBind
}

ProvidesQueueBind provides QueueBind as a method.

type ProvidesQueueDeclare

type ProvidesQueueDeclare interface {
	ProvidesMiddleware
	QueueDeclare(next HandlerQueueDeclare) HandlerQueueDeclare
}

ProvidesQueueDeclare provides QueueDeclare as a method.

type ProvidesQueueDeclarePassive

type ProvidesQueueDeclarePassive interface {
	ProvidesMiddleware
	QueueDeclarePassive(next HandlerQueueDeclare) HandlerQueueDeclare
}

ProvidesQueueDeclarePassive provides QueueDeclare as a method to be used for amqp.Channel.QueueDeclarePassive handlers.

type ProvidesQueueDelete

type ProvidesQueueDelete interface {
	ProvidesMiddleware
	QueueDelete(next HandlerQueueDelete) HandlerQueueDelete
}

ProvidesQueueDelete provides QueueDelete as a method.

type ProvidesQueueInspect

type ProvidesQueueInspect interface {
	ProvidesMiddleware
	QueueInspect(next HandlerQueueInspect) HandlerQueueInspect
}

ProvidesQueueInspect provides QueueInspect as a method.

type ProvidesQueuePurge

type ProvidesQueuePurge interface {
	ProvidesMiddleware
	QueuePurge(next HandlerQueuePurge) HandlerQueuePurge
}

ProvidesQueuePurge provides QueuePurge as a method.

type ProvidesQueueUnbind

type ProvidesQueueUnbind interface {
	ProvidesMiddleware
	QueueUnbind(next HandlerQueueUnbind) HandlerQueueUnbind
}

ProvidesQueueUnbind provides QueueUnbind as a method.

type ProvidesReject

type ProvidesReject interface {
	ProvidesMiddleware
	Reject(next HandlerReject) HandlerReject
}

ProvidesReject provides Reject as a method.

type Publish

type Publish func(next HandlerPublish) HandlerPublish

Publish defines signature for middleware invoked on *amqp.Channel.Publish() call.

type QoS

type QoS func(next HandlerQoS) HandlerQoS

QoS defines signature for middleware invoked on *amqp.Channel.QoS() call.

type QueueBind

type QueueBind = func(next HandlerQueueBind) HandlerQueueBind

QueueBind defines signature for middleware invoked on *amqp.Channel.QueueBind() call.

type QueueDeclare

type QueueDeclare = func(next HandlerQueueDeclare) HandlerQueueDeclare

QueueDeclare defines signature for middleware invoked on *amqp.Channel.QueueDeclare() and *amqp.Channel.QueueDeclarePassive() call.

type QueueDelete

type QueueDelete = func(next HandlerQueueDelete) HandlerQueueDelete

QueueDelete defines signature for middleware invoked on *amqp.Channel.QueueDelete() call.

type QueueInspect

type QueueInspect = func(next HandlerQueueInspect) HandlerQueueInspect

QueueInspect defines signature for middleware invoked on *amqp.Channel.QueueInspect() call.

type QueuePurge

type QueuePurge = func(next HandlerQueuePurge) HandlerQueuePurge

QueuePurge defines signature for middleware invoked on *amqp.Channel.QueuePurge() call.

type QueueUnbind

type QueueUnbind = func(next HandlerQueueUnbind) HandlerQueueUnbind

QueueUnbind defines signature for middleware invoked on *amqp.Channel.QueueUnbind() call.

type Reject

type Reject func(next HandlerReject) HandlerReject

Reject defines signature for middleware invoked on *amqp.Channel.Reject() call.

type ResultsChannelReconnect

type ResultsChannelReconnect struct {
	// Channel is the newly connected underlying channel.
	Channel *streadway.Channel
	// CloseNotifications is the channel that the transport manager will listen to
	// closure events on.
	CloseNotifications chan *streadway.Error
}

ResultsChannelReconnect are the result values from a Channel reconnection event for middleware to inspect.

type ResultsConnectionReconnect

type ResultsConnectionReconnect struct {
	// Connection is the newly connected underlying connection.
	Connection *streadway.Connection
	// CloseNotifications is the channel that the transport manager will listen to
	// closure events on.
	CloseNotifications chan *streadway.Error
}

ResultsConnectionReconnect are the result values from a Connection reconnection event for middleware to inspect.

type ResultsConsume

type ResultsConsume struct {
	DeliveryChan <-chan internal.Delivery
}

ResultsConsume are the result values from a Channel.Consume call for middleware to inspect.

type ResultsGet

type ResultsGet struct {
	Msg internal.Delivery
	Ok  bool
}

ResultsGet are the result values from a Channel.Get call for middleware to inspect.

type ResultsNotifyCancel

type ResultsNotifyCancel struct {
	Cancellations chan string
}

ResultsNotifyCancel stores the results from amqp.Channel.NotifyCancel for middleware to inspect.

type ResultsNotifyClose

type ResultsNotifyClose struct {
	CallerChan chan *streadway.Error
}

ResultsNotifyClose are the result values from a call to the NotifyClose method on a Connection or Channel.

type ResultsNotifyConfirm

type ResultsNotifyConfirm struct {
	Ack  chan uint64
	Nack chan uint64
}

ResultsNotifyConfirm are the result values from a Channel.NotifyConfirm call for middleware to inspect.

type ResultsNotifyConfirmOrOrphaned

type ResultsNotifyConfirmOrOrphaned struct {
	Ack      chan uint64
	Nack     chan uint64
	Orphaned chan uint64
}

ResultsNotifyConfirmOrOrphaned are the result values from a Channel.NotifyConfirmOrOrphaned call for middleware to inspect.

type ResultsNotifyFlow

type ResultsNotifyFlow struct {
	FlowNotifications chan bool
}

ResultsNotifyFlow stores the results from amqp.Channel.NotifyFlow for middleware to inspect.

type ResultsNotifyPublish

type ResultsNotifyPublish struct {
	Confirm chan internal.Confirmation
}

ResultsNotifyPublish stores the results from amqp.Channel.NotifyPublish() for middleware to inspect.

type ResultsNotifyReturn

type ResultsNotifyReturn struct {
	Returns chan streadway.Return
}

ResultsNotifyReturn stores the results from amqp.Channel.NotifyReturn for middleware to inspect.

type ResultsQueueDeclare

type ResultsQueueDeclare struct {
	Queue streadway.Queue
}

ResultsQueueDeclare are the result values from a Channel.QueuePurge call for middleware to inspect.

type ResultsQueueDelete

type ResultsQueueDelete struct {
	Count int
}

ResultsQueueDelete are the result values from a Channel.QueueDelete call for middleware to inspect.

type ResultsQueueInspect

type ResultsQueueInspect struct {
	Queue streadway.Queue
}

ResultsQueueInspect are the result values from a Channel.QueueInspect call for middleware to inspect.

type ResultsQueuePurge

type ResultsQueuePurge struct {
	Count int
}

ResultsQueuePurge are the result values from a Channel.QueuePurge call for middleware to inspect.

type TransportType

type TransportType string

TransportType is passed into handlers who's definition is shared between amqp.Channel values and amqp.Connection values.

Jump to

Keyboard shortcuts

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