pubsub

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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(topic string, message interface{}) error
}

Publisher provides adapter to publish message

func NewPublisher

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

NewPublisher implements adapter instance for Publisher

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 implements adapter instance for Subscriber

Jump to

Keyboard shortcuts

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