rabbitmq

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 7 Imported by: 0

README

RabbitMQ RPC for Go

Installation

go get github.com/Girein/rabbitmq-rpc-go

Setup

Add these in your .env file:

RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_VHOST_FOOBAR=""
RABBITMQ_QUEUE_FOOBAR=rpc_queue

Usage

import "github.com/Girein/rabbitmq-rpc-go"

rabbitMQConnection := new(rabbitmq.Connection)
rabbitMQConnection.New("FOOBAR")
status, message, data := rabbitmq.NewRPCRequest(rabbitMQConnection, rabbitmq.Payload{"RPC Testing", nil, nil})

fmt.Println(status)
fmt.Println(message)
fmt.Println(data)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPCRequest

func NewRPCRequest(connection *Connection, body map[string]interface{}) (map[string]interface{}, error)

NewRPCRequest sends message to the RPC worker

func SendMessage added in v1.0.2

func SendMessage(connection *Connection, body map[string]interface{}) error

SendMessage sends message to the consumer

Types

type Connection

type Connection struct {
	Host, Port, Username, Password, VirtualHost, QueueName string
}

Connection RabbitMQ

func (*Connection) New

func (connection *Connection) New(serviceName string)

New set the RabbitMQ Connection

Jump to

Keyboard shortcuts

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