go_amqp_lib

package module
v0.0.0-...-9b2f9d3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 7 Imported by: 0

README

go-amqp-lib

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmqpConfig

type AmqpConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	VHost    string
}

type Client

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

func NewClient

func NewClient() *Client

func (*Client) CloseConsume

func (client *Client) CloseConsume(consume *Consume) error

func (*Client) Consume

func (client *Client) Consume(queueName string, isReplyBy bool, isQuorum bool) (*Consume, error)

func (*Client) Init

func (client *Client) Init(config AmqpConfig, prefetchCount int, wg *sync.WaitGroup)

func (*Client) IsReady

func (client *Client) IsReady() bool

func (*Client) Publish

func (client *Client) Publish(
	channel *amqp.Channel,
	route string,
	body []byte,
	replyTo *string,
) error

func (*Client) Run

func (client *Client) Run(ctx context.Context) error

func (*Client) Shutdown

func (client *Client) Shutdown(ctx context.Context)

type Consume

type Consume struct {
	Name, QueueName                string
	Channel                        *amqp.Channel
	QueueTable                     amqp.Table
	Durable, Exclusive, AutoDelete bool
	Delivery                       <-chan amqp.Delivery
}

type Consumer

type Consumer interface {
	GetQueueName() string
	IsQuorum() bool
	Handle(ctx context.Context, channel *amqp.Channel, delivery *amqp.Delivery, amqp *Client)
}

type Consuming

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

func NewConsuming

func NewConsuming(amqp *Client) *Consuming

func (*Consuming) AddConsumer

func (consuming *Consuming) AddConsumer(consumer Consumer)

func (*Consuming) Init

func (consuming *Consuming) Init(consumingMaxJobsCount uint64, wg *sync.WaitGroup, shutdownChan chan<- interface{})

func (*Consuming) Run

func (consuming *Consuming) Run(ctx context.Context)

type Request

type Request[T any] struct {
	Id        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	ExpiresAt time.Time `json:"expiresAt"`
	Payload   T         `json:"payload"`
}

type Response

type Response[T any] struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Payload T      `json:"payload"`
}

Jump to

Keyboard shortcuts

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