rmqp

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 6 Imported by: 14

README

Using :

  1. go env -w GO111MODULE=on
  2. go get github.com/wiliehidayat87/rmqp
  3. go mod init [inside_your_project_name]
  4. go mod tidy
  5. go mod vendor

Run :

  1. go build -o [your_project_name]
  2. ./your_project_name consume
  3. ./your_project_name publish "Something in your mind message"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUpOnceChannel

func SetUpOnceChannel(rabbit *amqp.Connection, exchType string, exchDurable bool, exchName string, queueDurable bool, queueName string) (*amqp.Channel, *amqp.Queue, error)

SetUpOnceChannel : Setup the once channel of related connection Params : 1. @c ( Connection struct compiler consist of Connection & Channel of this interface for this AMQP ) -> struct interface 2. @logName ( Writing of the related worker ) -> string 3. @exchaneName ( Exchange AMQP Name ) -> string 4. @queueName ( Queue AMQP Name ) -> string Return : 1. @Chn ( Struct ) -> struct interface

Types

type AMQP

type AMQP struct {
	MsgBrokerURL string
	Connection   *amqp.Connection
	ErrConn      error
	Channel      *amqp.Channel
	ErrChannel   error
	Queue        *amqp.Queue
	ErrQueue     error
	ExchangeName string
}

Initiate a struct of a connection

func (*AMQP) IntegratePublish

func (rabbit *AMQP) IntegratePublish(exch string, queue string, contentType string, correlationId string, requestBody string) bool

IntegratePublish : publish a message

func (*AMQP) PublishMsg

func (rabbit *AMQP) PublishMsg(pi PublishItems) bool

Publish V2 : publish a message with several new added parameter

func (*AMQP) SetAmqpURL

func (rabbit *AMQP) SetAmqpURL(host string, port int, uname string, pwd string, vhost string)

SetAmqpURL : Build an AMQP URL via config param : nil return : 1. @URL ( Connection string of AMQP for dailing ) -> string

func (*AMQP) SetUpChannel

func (rabbit *AMQP) SetUpChannel(exchType string, exchDurable bool, exchName string, queueDurable bool, queueName string) error

SetUpChannel : Setup the once channel of related connection Params : 1. @c ( Connection struct compiler consist of Connection & Channel of this interface for this AMQP ) -> struct interface 2. @logName ( Writing of the related worker ) -> string 3. @exchaneName ( Exchange AMQP Name ) -> string 4. @queueName ( Queue AMQP Name ) -> string Return : 1. @Chn ( Struct ) -> struct interface

func (*AMQP) SetUpConnectionAmqp

func (rabbit *AMQP) SetUpConnectionAmqp() error

SetUpConnectionAmqp : Setup and initiation of dailing of the connection this will handle AMQP connection and channel of themself param : 1. @rabbitURL ( Rabbit URL of the connection string ) -> string returns : 1. @Conn ( Connection struct compiler consist of Connection & Channel of AMQP ) -> struct interface 2. @error ( Related error ) -> error

func (*AMQP) SetUpConnectionAmqpV2 added in v1.0.7

func (rabbit *AMQP) SetUpConnectionAmqpV2()

SetUpConnectionAmqp : Setup and initiation of dailing of the connection this will handle AMQP connection and channel of themself param : 1. @rabbitURL ( Rabbit URL of the connection string ) -> string returns : 1. @Conn ( Connection struct compiler consist of Connection & Channel of AMQP ) -> struct interface 2. @error ( Related error ) -> error

func (*AMQP) SetupConnectionAmqpAndReconnect added in v1.0.6

func (rabbit *AMQP) SetupConnectionAmqpAndReconnect() error

func (*AMQP) Subscribe

func (rabbit *AMQP) Subscribe(qos int, autoAck bool, routingKey string, exchName string, queueName string) (<-chan amqp.Delivery, error)

Subscribe : consuming a message

type PublishItems

type PublishItems struct {
	ExchangeName string
	QueueName    string
	ContentType  string
	Priority     uint8
	CorId        string
	Payload      string
}

Initiate a struct of a connection

Jump to

Keyboard shortcuts

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