dgamqp

package
v0.0.0-...-561878d Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 5 Imported by: 0

README

##AMQP

Builtin supports using AMQP as both brokers and backends, we implement NamedBroker and Backend in this component:

import dgamqp // package name is prefixed 'dg' to avoid confliction with "amqp" package

brk, err := dgamqp.NewBroker(nil)  // create a Redis-Broker with default configuration
bkd, err := dgamqp.NewBackend(nil) // create a Redis-Backend with default configuration

Internally, a rabbitmq server would be installer for testing.

There is nothing much to config so far. More option would be added as needed.

import dgamqp

config := dgamqp.DefaultAmqpConfig()
cfg.Host("127.0.0.1") // host address
  .Port(123) // host port
  .User("user123") // user name
  .Password("pwd123") // password
  .MaxChannel(128) // maximum channels preallocated

// create with new configuration
brk, err := dgamqp.NewBroker(cfg)
bkd, err := dgamqp.NewBackend(cfg)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBackend

func NewBackend(cfg *AmqpConfig) (v *backend, err error)

func NewBroker

func NewBroker(cfg *AmqpConfig) (v *broker, err error)

Types

type AmqpChannel

type AmqpChannel struct {
	Channel *amqp.Channel
	Confirm chan amqp.Confirmation
	Cancel  chan string
}

type AmqpConfig

type AmqpConfig struct {
	Host_       string `json:"Host"`
	Port_       int    `json:"Port"`
	User_       string `json:"User"`
	Password_   string `json:"Password"`
	MaxChannel_ int    `json:"MaxChannel"`
}

func DefaultAmqpConfig

func DefaultAmqpConfig() *AmqpConfig

func (*AmqpConfig) Connection

func (me *AmqpConfig) Connection() string

func (*AmqpConfig) GetMaxChannel

func (me *AmqpConfig) GetMaxChannel() int

func (*AmqpConfig) Host

func (me *AmqpConfig) Host(host string) *AmqpConfig

func (*AmqpConfig) MaxChannel

func (me *AmqpConfig) MaxChannel(count int) *AmqpConfig

func (*AmqpConfig) Password

func (me *AmqpConfig) Password(password string) *AmqpConfig

func (*AmqpConfig) Port

func (me *AmqpConfig) Port(port int) *AmqpConfig

func (*AmqpConfig) User

func (me *AmqpConfig) User(user string) *AmqpConfig

type AmqpConnection

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

func (*AmqpConnection) Channel

func (me *AmqpConnection) Channel() (ch *AmqpChannel, err error)

func (*AmqpConnection) Close

func (me *AmqpConnection) Close() error

func (*AmqpConnection) ReleaseChannel

func (me *AmqpConnection) ReleaseChannel(ci *AmqpChannel)

Jump to

Keyboard shortcuts

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