amqputils

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package amqputils is a library for creating easily client and a amqp servers

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timeout error")

ErrTimeout error

Functions

func Call

func Call(url, queueName string, info []byte, poolSize int) ([]byte, error)

Call a queue and receives the response

func CallWithConn

func CallWithConn(ch *amqp.Channel, queueName string, info []byte, poolSize int) ([]byte, error)

CallWithConn a queue and receives the response

func CallWithConnAsync

func CallWithConnAsync(ch *amqp.Channel, queueName string, info []byte, resp chan []byte, poolSize int) error

CallWithConnAsync a queue and receives the response in a channel

func CreateChannelConnection

func CreateChannelConnection(url string) (*amqp.Channel, func(), error)

CreateChannelConnection channel and its respective close function

func CreateConnection

func CreateConnection(url string) (*amqp.Connection, *amqp.Channel, func(), error)

CreateConnection connection - channel and its respective close function

func CreateQueue

func CreateQueue(ch *amqp.Channel, queueName string) (*amqp.Queue, error)

CreateQueue in the amqp server

func CreateQueueNotDurable

func CreateQueueNotDurable(ch *amqp.Channel, queueName string) (*amqp.Queue, error)

CreateQueueNotDurable in the amqp server not durable

func Publish

func Publish(url, queueName string, info []byte) error

Publish in a queue

func PublishWithConn

func PublishWithConn(ch *amqp.Channel, queueName string, info []byte) error

PublishWithConn in a queue

func Subscribe

func Subscribe(ch *amqp.Channel, q *amqp.Queue, do SubscribeFunc, poolConSize int) error

Subscribe to a queue and handle the messages

Types

type Server

type Server struct {
	Event     string
	Do        SubscribeFunc
	AMQPChan  *amqp.Channel
	AMQPQueue *amqp.Queue
	PoolSize  int
}

Server for receiving amqp messages

func HealtCheck

func HealtCheck(ch *amqp.Channel, queueService string) (*Server, error)

HealtCheck send a response each time that receive a message

func NewServer

func NewServer(ch *amqp.Channel, event string, do SubscribeFunc, poolSize int) (*Server, error)

NewServer creates one

func (*Server) Start

func (s *Server) Start()

Start the server

type SubscribeFunc

type SubscribeFunc func(amqp.Delivery) ([]byte, error)

SubscribeFunc function to handle an incoming message

type TunnyExecutor added in v1.5.0

type TunnyExecutor struct {
	Do       SubscribeFunc
	AMQPChan *amqp.Channel
	Delivery amqp.Delivery
}

TunnyExecutor pool args

Jump to

Keyboard shortcuts

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