mbroker

package
v0.0.0-...-fd9b66f Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionMQ

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

func New

func New(name string, addr string) *SessionMQ

New creates a new consumer state instance, and automatically attempts to connect to the server.

func (*SessionMQ) Close

func (session *SessionMQ) Close() error

Close will cleanly shutdown the channel and connection.

func (*SessionMQ) Push

func (session *SessionMQ) Push(data []byte) error

Push will push data onto the queue, and wait for a confirm. If no confirms are received until within the resendTimeout, it continuously re-sends messages until a confirm is received. This will block until the server sends a confirm. Errors are only returned if the push action itself fails, see UnsafePush.

func (*SessionMQ) Stream

func (session *SessionMQ) Stream() (<-chan amqp.Delivery, error)

Stream will continuously put queue items on the channel. It is required to call delivery.Ack when it has been successfully processed, or delivery.Nack when it fails. Ignoring this will cause data to build up on the server.

func (*SessionMQ) UnsafePush

func (session *SessionMQ) UnsafePush(data []byte) error

UnsafePush will push to the queue without checking for confirmation. It returns an error if it fails to connect. No guarantees are provided for whether the server will recieve the message.

Jump to

Keyboard shortcuts

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