pubsub

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Future added in v0.14.0

type Future interface {
	// Wait waits the broker to ack, will return error from the broker after sent the message if any.
	Wait() error
}

type GPSFuture added in v0.14.0

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

func (*GPSFuture) Wait added in v0.14.0

func (g *GPSFuture) Wait() error

type NSQFuture added in v0.14.0

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

func (*NSQFuture) Wait added in v0.14.0

func (n *NSQFuture) Wait() error

type Option added in v0.3.0

type Option func(c *config)

Option configures Publisher & Subscriber

func ContentType added in v0.10.0

func ContentType(name string, codec gobroker.Codec) Option

ContentType configures custom content-type for message body along with its codec

func GoogleJSON added in v0.3.0

func GoogleJSON(projectID, cluster string, cred []byte) Option

GoogleJSON configures Publisher & Subscriber for Google Cloud Pub/Sub auth using JSON bytes

func GoogleJSONFile added in v0.3.0

func GoogleJSONFile(projectID, cluster, filename string) Option

GoogleJSONFile configures Publisher & Subscriber for Google Cloud Pub/Sub auth using JSON filename

func MaxReconnect added in v0.8.0

func MaxReconnect(retry int) Option

MaxReconnect defines retry attempts to reconnect, 0 means unlimited retry

func NSQLookupd added in v0.13.0

func NSQLookupd(address string) Option

func RabbitMQAMQP added in v0.6.3

func RabbitMQAMQP(server, vHost string) Option

RabbitMQAMQP configures Publisher & Subscriber for RabbitMQ connection

type Publisher

type Publisher interface {
	// Publish publishes a message to a worker pool and might block for broker ack.
	Publish(topic string, message interface{}) error
	// PublishAsync publishes a message to a worker pool without waiting for broker ack.
	PublishAsync(topic string, message interface{}) Future
}

Publisher provides adapter to publish message

func NewPublisher

func NewPublisher(impl gobroker.Implementation, options ...Option) Publisher

NewPublisher returns the publisher instance based on the desired implementation

type RMQFuture added in v0.14.0

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

func (*RMQFuture) Wait added in v0.14.0

func (r *RMQFuture) Wait() error

type SubHandler added in v0.3.0

type SubHandler struct {
	Name        string
	Topic       string
	Handler     gobroker.Handler
	Concurrent  int
	MaxRequeue  int
	MaxInFlight int

	// Timeout configures an in-flight message ack deadline processed by subscriber
	Timeout time.Duration
}

SubHandler defines subscriber configuration

type Subscriber

type Subscriber interface {
	// Start will spawn workers to subscribe
	Start()
	// Stop will terminate all connections and workers
	Stop()
}

Subscriber provides adapter to subscribe topics

func NewSubscriber

func NewSubscriber(impl gobroker.Implementation, handlers []*SubHandler, options ...Option) Subscriber

NewSubscriber returns the subscriber instance based on the desired implementation

Directories

Path Synopsis
Package gomock is a generated GoMock package.
Package gomock is a generated GoMock package.

Jump to

Keyboard shortcuts

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