pubsubwrap

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterMiddleware

type FilterMiddleware interface {
	Filter(m *message.Message) (*message.Message, error)
}

FilterMiddleware an interface for message filtering and modification.

type MessageLockerByType

type MessageLockerByType struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMessageLockerByType

func NewMessageLockerByType(ctx context.Context) *MessageLockerByType

NewMessageLockerByType is a constructor for MessageLockerByType.

func (*MessageLockerByType) Filter

Filter returns nil for filtered message types.

func (*MessageLockerByType) GetMessagesFilters

GetMessagesFilters returns filter state and statistic per message type (as map).

func (*MessageLockerByType) SetMessagesFilter

SetMessagesFilter sets filter for provided message type.

type MessageStatByType

type MessageStatByType struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MessageStatByType holds publish statistic per message type.

func NewMessageStatByType

func NewMessageStatByType() *MessageStatByType

NewMessageStatByType is a constructor for MessageStatByType.

func (*MessageStatByType) Filter

Filter counts published messages by type.

func (*MessageStatByType) GetMessagesStat

GetMessagesStat returns publish statistic per message type.

type PublisherService

type PublisherService struct {
	*MessageLockerByType
	*MessageStatByType
}

PublisherService implements introproto.PublisherServer.

func NewPublisherService

func NewPublisherService(ml *MessageLockerByType, ms *MessageStatByType) PublisherService

NewPublisherService creates PublisherService.

type PublisherWrapper

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

PublisherWrapper wraps message Publisher.

func NewPublisherWrapper

func NewPublisherWrapper(pb message.Publisher) *PublisherWrapper

NewPublisherWrapper creates new message.Publisher wrapper.

func (*PublisherWrapper) Close

func (p *PublisherWrapper) Close() error

Close wraps message.Close method.

func (*PublisherWrapper) Middleware

func (p *PublisherWrapper) Middleware(fm ...FilterMiddleware)

Middleware adds middleware filters (order matters!).

func (*PublisherWrapper) Publish

func (p *PublisherWrapper) Publish(topic string, messages ...*message.Message) error

Publish wraps message.Publish method, i.e. applies all middleware filters for every message.

Jump to

Keyboard shortcuts

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