rabbitmq

package
v0.0.0-...-cfea203 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalProto

func MarshalProto(message proto.Message) ([]byte, error)

MarshalProto serializes a Protobuf message

func UnmarshalProto

func UnmarshalProto(data []byte, message proto.Message) error

UnmarshalProto deserializes a Protobuf message

Types

type MockRabbitMQ

type MockRabbitMQ struct {
	mock.Mock
}

func (*MockRabbitMQ) Close

func (m *MockRabbitMQ) Close()

func (*MockRabbitMQ) Consume

func (m *MockRabbitMQ) Consume(queueName string) (<-chan amqp091.Delivery, error)

func (*MockRabbitMQ) DeclareExchange

func (m *MockRabbitMQ) DeclareExchange(exchangeName, exchangeType string) error

func (*MockRabbitMQ) Publish

func (m *MockRabbitMQ) Publish(exchange, routingKey string, body []byte) error

func (*MockRabbitMQ) SetupQueue

func (m *MockRabbitMQ) SetupQueue(queueName, exchangeName string, routingKeys []string) error

type RabbitMQ

type RabbitMQ struct {
	Conn    *amqp091.Connection
	Channel *amqp091.Channel
}

func NewRabbitMQ

func NewRabbitMQ(url string) (*RabbitMQ, error)

func (*RabbitMQ) Close

func (x *RabbitMQ) Close()

func (*RabbitMQ) Consume

func (x *RabbitMQ) Consume(queueName string) (<-chan amqp091.Delivery, error)

Consume for start consumer

func (*RabbitMQ) DeclareExchange

func (x *RabbitMQ) DeclareExchange(exchangeName, exchangeType string) error

DeclareExchange for deklarasi exchange

func (*RabbitMQ) Publish

func (x *RabbitMQ) Publish(exchange, routingKey string, body []byte) error

Publish for publish message

func (*RabbitMQ) SetupQueue

func (x *RabbitMQ) SetupQueue(queueName, exchangeName string, routingKeys []string) error

SetupQueue binds multiple routing keys to a single queue using a slice

type RabbitMQInterface

type RabbitMQInterface interface {
	Close()
	DeclareExchange(exchangeName, exchangeType string) error
	Publish(exchange, routingKey string, body []byte) error
	SetupQueue(queueName, exchangeName string, routingKeys []string) error
	Consume(queueName string) (<-chan amqp091.Delivery, error)
}

Jump to

Keyboard shortcuts

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