pubsub

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 0 Imported by: 0

README

pubsublib

Common pubsub library to be used across OH libraries

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClient

func SetClient(cli *Client)

SetClient sets the global pubsub client, useful in tests

Types

type Client

type Client struct {
	ServiceName string
	Provider    Provider
	Middleware  []Middleware
}

Client holds a reference to a Provider

func (*Client) Publish

func (c *Client) Publish(topicARN string, message interface{}, messageAttributes map[string]interface{}) error

Publish published on the client

type MessageHandler

type MessageHandler func(message string) error

type Middleware

type Middleware interface {
	PublisherMsgInterceptor(serviceName string, next PublishHandler) PublishHandler
}

Middleware is an interface to provide subscriber and publisher interceptors

type NoopProvider

type NoopProvider struct{}

NoopProvider is a simple provider that does nothing, for testing, defaults

func (NoopProvider) PollMessages

func (np NoopProvider) PollMessages(queueURL string, handler MessageHandler) error

Subscribe does nothing

func (NoopProvider) Publish

func (np NoopProvider) Publish(topicARN string, message interface{}, messageAttributes map[string]interface{}) error

Publish does nothing

type Provider

type Provider interface {
	Publish(topicARN string, message interface{}, messageAttributes map[string]interface{}) error
	PollMessages(queueURL string, handler MessageHandler) error
}

type PublishHandler

type PublishHandler func(topicARN string, message interface{}, messageAttributes map[string]interface{}) error

PublishHandler wraps a call to publish, for interception

Directories

Path Synopsis
provider
aws

Jump to

Keyboard shortcuts

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