pubsub

package module
v1.2.19 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 5 Imported by: 4

README

pubsub

FOSSA Status

pub/sub abstraction

License

FOSSA Status

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleProviderSettings

type GoogleProviderSettings struct {
	ProjectID          string
	CredentialsFile    string
	SubscriptionSuffix string
	CreateTopic        bool
	CreateSubscription bool
}

GoogleProviderSettings type

type IPubSub

type IPubSub interface {
	Publish(ctx context.Context, topic string, msg []byte) error
	Subscribe(ctx context.Context, topic string, handler MsgHandler) (ISubscription, error)
	SubscribeChan(ctx context.Context, topic string, channel chan []byte) (ISubscription, error)
}

IPubSub Interface

func Create

func Create(ctx context.Context, settings Settings) (IPubSub, error)

Create the Pub sub

type ISubscription

type ISubscription interface {
	Close() error
}

ISubscription interface

type MsgHandler

type MsgHandler func(msg []byte)

MsgHandler is a callback function that processes messages delivered to asynchronous subscribers.

type NatsProviderSettings

type NatsProviderSettings struct {
	URL      string
	Token    string
	User     string
	Password string
}

NatsProviderSettings type

type ProviderType

type ProviderType string

ProviderType the type of provider

const (
	// GooglePubSubProvider type
	GooglePubSubProvider ProviderType = "googlePubSub"
	// NatsProvider type
	NatsProvider ProviderType = "nats"
	// MemoryProvider type
	MemoryProvider ProviderType = "memory"
)

type Settings

type Settings struct {
	Provider ProviderType
	Google   GoogleProviderSettings
	Nats     NatsProviderSettings
}

Settings for the pub sub

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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