artemis

package
v0.0.0-...-628530e Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncodingGob encoding = iota
	EncodingJson
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Receiver

type Receiver[T any] struct {

	// Addr is the address of the broker.
	Addr string

	// Dest is the default destination.
	Dest string

	// PubSub configures the type of destination.
	// 'true' for the publish-subscribe pattern (topics),
	// 'false' for the producer-consumer pattern (queues).
	PubSub bool

	// Enc specifies the encoding.
	// The default encoding is gob.
	Enc encoding
}

A Receiver receives messages of type T from the artemis broker.

func (*Receiver[T]) Receive

func (r *Receiver[T]) Receive(handler func(msg *T)) error

Receive receives messages from the default destination.

func (*Receiver[T]) ReceiveFrom

func (r *Receiver[T]) ReceiveFrom(destination string, handler func(msg *T)) error

ReceiveFrom receives messages from a specified destination.

func (*Receiver[T]) ReceiveMessages

func (r *Receiver[T]) ReceiveMessages(destination string, number uint64, handler func(msg *T)) error

ReceiveMessages receives a specified number of messages from a specified destination. If number is set to 0, it will receive an unlimited number of messages.

type Sender

type Sender struct {

	// Addr is the address of the broker.
	Addr string

	// Dest is the default destination.
	Dest string

	// PubSub configures the type of destination.
	// 'true' for the publish-subscribe pattern (topics),
	// 'false' for the producer-consumer pattern (queues).
	PubSub bool

	// Enc specifies the encoding.
	// The default encoding is gob.
	Enc encoding
}

A Sender sends messages to the artemis broker.

func (*Sender) Send

func (s *Sender) Send(messages ...any) error

Send sends messages to the default destination.

func (*Sender) SendTo

func (s *Sender) SendTo(destination string, messages ...any) error

SendTo sends messages to a specified destination.

Jump to

Keyboard shortcuts

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