rabbitmq

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	URI           string
	PrefetchCount int
	Exchange      string
	ExchangeType  string
}

Options for RabbitMQ broker

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns default RabbitMQ options

type RMQJob

type RMQJob struct {
	job.Job
	// contains filtered or unexported fields
}

RMQJob wraps a job with RabbitMQ-specific delivery information

type RabbitMQBroker

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

RabbitMQBroker implements the Broker interface for RabbitMQ

func NewBroker

func NewBroker(options Options, serializer core.Serializer) *RabbitMQBroker

NewBroker creates a new RabbitMQ broker

func (*RabbitMQBroker) Ack

func (r *RabbitMQBroker) Ack(ctx context.Context, j job.Job) error

Ack acknowledges job completion

func (*RabbitMQBroker) Capabilities

func (r *RabbitMQBroker) Capabilities() core.BrokerCapabilities

Capabilities returns RabbitMQ broker capabilities

func (*RabbitMQBroker) Close

func (r *RabbitMQBroker) Close() error

Close closes the RabbitMQ connection

func (*RabbitMQBroker) Connect

func (r *RabbitMQBroker) Connect(ctx context.Context) error

Connect establishes connection to RabbitMQ

func (*RabbitMQBroker) CreateQueue

func (r *RabbitMQBroker) CreateQueue(ctx context.Context, name string, options core.QueueOptions) error

CreateQueue creates a new queue

func (*RabbitMQBroker) DeleteQueue

func (r *RabbitMQBroker) DeleteQueue(ctx context.Context, name string) error

DeleteQueue deletes a queue

func (*RabbitMQBroker) Dequeue

func (r *RabbitMQBroker) Dequeue(ctx context.Context, queue string) (job.Job, error)

Dequeue retrieves a job from the queue

func (*RabbitMQBroker) Enqueue

func (r *RabbitMQBroker) Enqueue(ctx context.Context, j job.Job) error

Enqueue adds a job to the queue

func (*RabbitMQBroker) Health

func (r *RabbitMQBroker) Health() error

Health checks the RabbitMQ connection health COMMENT: Not doing a PING here unlike Redis, is this enough. Do we need to open/close a channel to confirm?

func (*RabbitMQBroker) Nack

func (r *RabbitMQBroker) Nack(ctx context.Context, j job.Job, requeue bool) error

Nack rejects a job and optionally requeues it

func (*RabbitMQBroker) QueueExists

func (r *RabbitMQBroker) QueueExists(ctx context.Context, name string) (bool, error)

QueueExists checks if a queue exists

func (*RabbitMQBroker) QueueLength

func (r *RabbitMQBroker) QueueLength(ctx context.Context, name string) (int64, error)

QueueLength returns the number of jobs in a queue

func (*RabbitMQBroker) SetLogger

func (r *RabbitMQBroker) SetLogger(logger seelog.LoggerInterface)

SetLogger sets the logger for the broker

func (*RabbitMQBroker) Type

func (r *RabbitMQBroker) Type() string

Type returns the broker type

Jump to

Keyboard shortcuts

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