messaging

package
v0.0.0-...-4b72d78 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CredsPath      string
	TopicID        string
	SubscriptionID string
	ProjectID      string
}

A Config stores the configuration for messaging Client instances

type Messenger

type Messenger struct {
	PubsubClient   *pubsub.Client
	SubscriptionID string
	TopicID        string
	Subscription   *pubsub.Subscription
}

A Messenger provies the API for interacting with a pubsub messaging queue (google Pub/Sub)

func New

func New(config Config) (*Messenger, error)

New returns a new Messenger with provided configuration initialized and attached

func (*Messenger) DeleteSub

func (m *Messenger) DeleteSub() error

DeleteSub removes the subscription

func (*Messenger) RunListener

func (m *Messenger) RunListener(ctx context.Context, msgChan chan<- Msg) error

type MessengerInterface

type MessengerInterface interface {
	RunListener(context.Context, chan<- Msg) error
	DeleteSub() error
}

type Msg

type Msg struct {
	Data MsgContents `json:"data"`
}

type MsgContents

type MsgContents struct {
	Message string `json:"message"`
}

type NoopMessenger

type NoopMessenger struct{}

func (*NoopMessenger) DeleteSub

func (m *NoopMessenger) DeleteSub() error

func (*NoopMessenger) RunListener

func (m *NoopMessenger) RunListener(ctx context.Context, msgChan chan<- Msg) error

Jump to

Keyboard shortcuts

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