messaging

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockNotificationService

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

MockNotificationService is used to mock notifications in-memory for tests

func NewMockNotificationService

func NewMockNotificationService() (*MockNotificationService, error)

NewMockNotificationService initializes a mock notification service

func (MockNotificationService) Notify

func (mn MockNotificationService) Notify(
	ctx context.Context,
	topicID string,
	uid string,
	flavour feedlib.Flavour,
	payload feedlib.Element,
	metadata map[string]interface{},
) error

Notify MOCKS sending of a feed element to the message bus

func (MockNotificationService) ReverseSubscriptionIDs

func (mn MockNotificationService) ReverseSubscriptionIDs() map[string]string

ReverseSubscriptionIDs returns a map of subscription IDs to topic IDs for the subscriptions known to this mock service

func (MockNotificationService) SubscriptionIDs

func (mn MockNotificationService) SubscriptionIDs() map[string]string

SubscriptionIDs returns a map of topic IDs to subscription IDs for the topics and subscriptions known to this mock notification service

func (MockNotificationService) TopicIDs

func (mn MockNotificationService) TopicIDs() []string

TopicIDs returns topic IDs known to this mock notification service

type NotificationService

type NotificationService interface {

	// Send a message to a topic
	Notify(
		ctx context.Context,
		topicID string,
		uid string,
		flavour feedlib.Flavour,
		payload feedlib.Element,
		metadata map[string]interface{},
	) error

	// Ask the notification service about the topics that it knows about
	TopicIDs() []string

	SubscriptionIDs() map[string]string

	ReverseSubscriptionIDs() map[string]string

	Push(
		ctx context.Context,
		sender string,
		payload firebasetools.SendNotificationPayload,
	) error
}

NotificationService represents logic required to communicate with pubsub it defines the behavior of our notifications

func NewPubSubNotificationService

func NewPubSubNotificationService(
	ctx context.Context,
	projectID string,
) (NotificationService, error)

NewPubSubNotificationService initializes a live notification service

type PubSubNotificationService

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

PubSubNotificationService sends "real" (production) notifications

func (PubSubNotificationService) Notify

func (ps PubSubNotificationService) Notify(
	ctx context.Context,
	topicID string,
	uid string,
	flavour feedlib.Flavour,
	el feedlib.Element,
	metadata map[string]interface{},
) error

Notify sends a notification to the specified topic. A search engine index job can be one of the listeners on this channel.

func (PubSubNotificationService) Push added in v0.0.17

func (ps PubSubNotificationService) Push(
	ctx context.Context,
	sender string,
	notificationPayload firebasetools.SendNotificationPayload,
) error

Push instructs a remote FCM service to send a push notification.

This is done over Google Cloud Pub-Sub.

func (PubSubNotificationService) ReverseSubscriptionIDs

func (ps PubSubNotificationService) ReverseSubscriptionIDs() map[string]string

ReverseSubscriptionIDs ... TODO implement this

func (PubSubNotificationService) SubscriptionIDs

func (ps PubSubNotificationService) SubscriptionIDs() map[string]string

SubscriptionIDs ... TODO Implement this

func (PubSubNotificationService) TopicIDs

func (ps PubSubNotificationService) TopicIDs() []string

TopicIDs returns the known (registered) topic IDs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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