lbstomp

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 9 Imported by: 6 modules, 6 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.

README

lb-stomp

Build Status Go Report Card GoDoc

Load-balanced Stomp (lb-stomp) package provides load-balanced interface to Stomp AMQ brokers.

Built and test code:

go build
go test

Example how to use it

import stomp "github.com/vkuznet/lb-stomp"

// create new manager
config := stomp.Config{StompURI: "abc:123", StompLogin: "test", StompPassword: "test"}
mgr := stomp.New(config)
data := `{"test": 1}`
err := stomp.Send([]byte(data))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI                  string  `json:"uri"`                  // Stomp AMQ URI
	Login                string  `json:"login"`                // Stomp AQM login name
	Password             string  `json:"password"`             // Stomp AQM password
	Iterations           int     `json:"iterations"`           // Stomp iterations
	SendTimeout          int     `json:"sendTimeout"`          // heartbeat send timeout
	RecvTimeout          int     `json:"recvTimeout"`          // heartbeat recv timeout
	HeartBeatGracePeriod float64 `json:"heartBeatGracePeriod"` // is used to calculate the read heart-beat timeout
	Endpoint             string  `json:"endpoint"`             // StompAMQ endpoint
	ContentType          string  `json:"contentType"`          // ContentType of UDP packet
	Protocol             string  `json:"protocol"`             // network protocol to use
	Verbose              int     `json:"verbose"`              // verbosity level
}

Config stores server configuration parameters

type StompManager

type StompManager struct {
	Addresses      []string      // stomp addresses
	ConnectionPool []*stomp.Conn // pool of connections to stomp AMQ Broker
	Config         Config        // stomp configuration
}

StompManager hanles connection to Stomp AMQ Broker

func New

func New(config Config) *StompManager

New creates new instance of StompManager

func (*StompManager) GetConnection added in v0.0.4

func (s *StompManager) GetConnection() (*stomp.Conn, string, error)

get new stomp connection

func (*StompManager) ResetConnection added in v0.0.4

func (s *StompManager) ResetConnection()

reset all stomp connections

func (*StompManager) Send

func (s *StompManager) Send(data []byte, opts ...func(*frame.Frame) error) error

helper function to send data to stomp

func (*StompManager) String

func (s *StompManager) String() string

String represents Stomp Manager

Jump to

Keyboard shortcuts

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