gohare

package module
v0.0.0-...-db54b91 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 6 Imported by: 0

README

gohare

Golang pub-sub framework.

Framework which allows you easliy create pub-sub microsevices infrastrucutre, using GoLang, with consistant api, and concurrent rpc requests where necessary.

Documentation

Works are currently in progress, it will appear soon

Still under developement, if you are interested in contribution, contact with me

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonToStruct

func JsonToStruct(rawResponse []byte, jsonResponse interface{})

Types

type ErrorForm

type ErrorForm struct {
	ErrorMessage string `json:"error"`
}

func MakeErrorResponse

func MakeErrorResponse(message string) (ErrorForm, bool)

type Event

type Event struct {
	Message *amqp.Delivery
	// contains filtered or unexported fields
}

func (*Event) Error

func (eve *Event) Error(errorMessage string)

func (*Event) GetResponse

func (eve *Event) GetResponse(response interface{}) []byte

func (*Event) MakeResponse

func (eve *Event) MakeResponse(response interface{})

func (*Event) Send

func (e *Event) Send(routingKey string, messageBody []byte)

type Handler

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

type Rabbit

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

func NewHare

func NewHare(url string, queueName string) *Rabbit

func (*Rabbit) Listen

func (r *Rabbit) Listen()

Main listening function

func (*Rabbit) Publish

func (r *Rabbit) Publish(sendR sendRequest)

func (*Rabbit) Request

func (r *Rabbit) Request(requests []*RequestForm)

func (*Rabbit) Subscribe

func (r *Rabbit) Subscribe(routingKey string, handler func(event *Event), rpc bool)

type RequestForm

type RequestForm struct {
	RoutingKey      string
	MessageBody     []byte
	CorrelationId   string
	Response        []byte
	IsResponseError bool
}

func NewRequest

func NewRequest(routingKey string, messageBody []byte) *RequestForm

Jump to

Keyboard shortcuts

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