rabbitmq

package
v0.0.0-...-2bf50d5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExchangeOpenGames is the exchange where open games are distributed by dispatcherID
	ExchangeOpenGames = "ExchangeOpenGames"
	// QueueOpenGamesRandom is the workqueu where new games are published and picked up at random by any gameserver
	QueueOpenGamesRandom = "OpenGamesRandom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID       *string
	AMQPUrl  string
	Conn     *amqp.Connection
	Outgoing *amqp.Channel
}

Client used to communicate with rabbitmq

func NewClient

func NewClient(id *string, amqpURL string, amqpUser string, amqpPass string) (*Client, error)

NewClient returns the amqp client

func (*Client) EnsureOpenGamesRandomQueueExists

func (c *Client) EnsureOpenGamesRandomQueueExists() error

EnsureOpenGamesRandomQueueExists declares the queue for open games waiting to be picked up by a gameserver

func (*Client) Init

func (c *Client) Init() error

Init initializes the amqp client

func (*Client) NewChannel

func (c *Client) NewChannel() (*amqp.Channel, error)

NewChannel returns a new channel from the amqp connection

func (*Client) PublishOpenGameForDispatcher

func (c *Client) PublishOpenGameForDispatcher(message *messaging.Container, dispatcherID string) error

PublishOpenGameForDispatcher publishes a new game to exchange where it will be picked up by the matching dispatcher

func (*Client) PublishRandomGameToWorkQueue

func (c *Client) PublishRandomGameToWorkQueue(message *messaging.Container) error

PublishRandomGameToWorkQueue publishes a new game to the random games work queue

Jump to

Keyboard shortcuts

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