mead

package module
v0.0.0-...-545ce15 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: MIT Imports: 6 Imported by: 0

README

mead

Mead is an abstraction to unify message exachange between hosts using NATS+JSON+ale

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MailHandler

type MailHandler func(data.Object) data.Object

MailHandler process a message

type Mailbox

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

Mailbox contains a subscription to a NATS subject

type PO

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

PO (short for PostOffice) is responsible for managing multple mailboxes

Each mailbox is represented by a subscription to a subject topic in a NATS.

func NewPO

func NewPO(url string) (*PO, error)

NewPO returns a connected PO with some pre-existing subscriptions

func (*PO) AcquireMailbox

func (p *PO) AcquireMailbox(name, group string, handler MailHandler) (*Mailbox, error)

AcquireMailbox opens a new subscription for the given name and optionally register it with the group information.

Using a group allows for the messages sent to name to be distributed by multiple nodes, as long as they belong to the same group.

Not providing a group name defaults to a pub/sub mode where all nodes subscribing to the given name will receive copies of the message.

func (*PO) Close

func (p *PO) Close() error

Close the PO box and drains all connections

Jump to

Keyboard shortcuts

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