mq

package
v0.0.0-...-317f090 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 9 Imported by: 0

README

MQ Adapter

This package provides a simple abstraction for a message queue.

Support MQ

  • RabbitMQ
  • Kafka/RedPanda
  • NATS
  • Redis
  • NSQ
  • Apache Pulsar
  • AWS SQS

Documentation

Overview

Message Queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataBus

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

DataBus abstract type

func (*DataBus) Init

func (mq *DataBus) Init(ctx context.Context, log logger.Logger) error

Init - init connection

func (*DataBus) Publish

func (mq *DataBus) Publish(ctx context.Context, target string, key, payload []byte) error

Publish - publish to a topic

func (*DataBus) Subscribe

func (mq *DataBus) Subscribe(ctx context.Context, target string, message query.Response) error

Subscribe - subscribe to a topic

func (*DataBus) UnSubscribe

func (mq *DataBus) UnSubscribe(target string) error

UnSubscribe - unsubscribe to a topic

func (*DataBus) Use

func (mq *DataBus) Use(ctx context.Context, log logger.Logger) (*DataBus, error)

Use return implementation of MQ

type MQ

type MQ interface {
	Init(ctx context.Context, log logger.Logger) error

	// Pub/Sub a pattern
	Publish(ctx context.Context, target string, routingKey []byte, payload []byte) error
	Subscribe(ctx context.Context, target string, message query.Response) error
	UnSubscribe(target string) error
}

MQ - common interface of DataBus

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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