Documentation ¶
Index ¶
- Constants
- type Connection
- type ConnectionFactory
- type Consumer
- type ConsumerOption
- type ConsumerParams
- type ControllerFunc
- type DeliveryContext
- type ExchangeParams
- type GroupOption
- type Publisher
- type PublisherOption
- type QualityOfService
- type QueueParams
- type Router
- type RouterEngine
- type RouterGroup
- type Server
Constants ¶
View Source
const (
DefaultCircuitBreakerConsecutiveFailuresAllowed = 10
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { *amqp.Connection // contains filtered or unexported fields }
func NewConnection ¶
func NewConnection(conn *amqp.Connection, factory ConnectionFactory, logger *slog.Logger) *Connection
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) IsAlive ¶
func (c *Connection) IsAlive() bool
func (*Connection) NotifyClose ¶
func (c *Connection) NotifyClose(ch chan error) chan error
func (*Connection) NotifyReconnect ¶
func (c *Connection) NotifyReconnect(ch chan error) chan error
type ConnectionFactory ¶
type ConnectionFactory func() (*amqp.Connection, error)
type Consumer ¶
type Consumer struct { Conn *Connection Channel *amqp.Channel // contains filtered or unexported fields }
func NewConsumer ¶
func NewConsumer(conn *Connection, queueParams QueueParams, opts ...ConsumerOption) (*Consumer, error)
func (*Consumer) DeclaredQueue ¶
type ConsumerOption ¶
type ConsumerOption func(p *Consumer)
func WithConsumerQos ¶
func WithConsumerQos(qos QualityOfService) ConsumerOption
func WithExchangeDeclare ¶
func WithExchangeDeclare(exchangeParams ExchangeParams, queueBindingKey string) ConsumerOption
WithExchangeDeclare будет создавать exchange при создании канала подключения если queueBindingKey = "", биндинг будет осуществляться по названию очереди
type ConsumerParams ¶
type ControllerFunc ¶
type ControllerFunc func(ctx *DeliveryContext)
type DeliveryContext ¶
type DeliveryContext struct { context.Context Delivery amqp.Delivery Channel *amqp.Channel Acked bool Nacked bool // contains filtered or unexported fields }
func NewDeliveryContext ¶
func NewDeliveryContext( baseCtx context.Context, delivery amqp.Delivery, ch *amqp.Channel, handlers []ControllerFunc, ) *DeliveryContext
func (*DeliveryContext) Ack ¶
func (c *DeliveryContext) Ack() bool
func (*DeliveryContext) BindJSON ¶
func (c *DeliveryContext) BindJSON(ptr interface{}) error
func (*DeliveryContext) Next ¶
func (c *DeliveryContext) Next()
func (*DeliveryContext) Set ¶ added in v0.1.2
func (c *DeliveryContext) Set(key string, value any)
type ExchangeParams ¶
type GroupOption ¶
type GroupOption func(g *RouterGroup)
func WithNumWorkers ¶
func WithNumWorkers(workers int) GroupOption
func WithRouterEngine ¶
func WithRouterEngine(engine RouterEngine) GroupOption
type Publisher ¶
type Publisher struct { Conn *Connection // contains filtered or unexported fields }
func NewPublisher ¶
func NewPublisher(connection *Connection, exchangeParams ExchangeParams, opts ...PublisherOption) (*Publisher, error)
type PublisherOption ¶
type PublisherOption func(p *Publisher)
func WithLogger ¶
func WithLogger(logger *slog.Logger) PublisherOption
func WithQueueDeclaration ¶
func WithQueueDeclaration(queueParams QueueParams, bindingKey string) PublisherOption
func WithRetries ¶
func WithRetries() PublisherOption
type QualityOfService ¶
type QueueParams ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Group ¶
func (r *Router) Group(exchange ExchangeParams, queue QueueParams, qos QualityOfService, consumer ConsumerParams, opts ...GroupOption) *RouterGroup
Group обобщает транспорт consumer`а, объединяя в себе декларацию и параметры exchangeParams и queueParams
type RouterEngine ¶
type RouterEngine interface { // AddBinding добавляет маршрутизацию контроллеров в роутер AddBinding(bindingKey string, controllers ...ControllerFunc) // Route подбирает все подходящие контроллеры по настроенным параметрам маршрутизации Route(routingKey string) []ControllerFunc }
func NewDirectRouterEngine ¶
func NewDirectRouterEngine() RouterEngine
func NewTopicRouterEngine ¶
func NewTopicRouterEngine() RouterEngine
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) Route ¶
func (g *RouterGroup) Route(routingKey string, controllers ...ControllerFunc) *RouterGroup
Route регистрирует маршрутизацию сообщений для конкретной очереди в рамках одной RouterGroup При чтении из очереди сообщения будут маршрутизироваться в соответствующие контроллеры по параметру RoutingKey
type Server ¶
type Server struct { Conn *Connection // contains filtered or unexported fields }
func NewServer ¶
func NewServer(conn *Connection, router *Router) *Server
Source Files ¶
Click to show internal directories.
Click to hide internal directories.