Version: v0.0.19 Latest Latest

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 9 Imported by: 0




View Source
const (
	// ServiceName ..
	ServiceName = "onboarding"

	// TopicVersion ...
	TopicVersion = "v1"


This section is empty.


This section is empty.


type ServicePubSub

type ServicePubSub interface {
	// Ask the notification service about the topics that it knows about
	TopicIDs() []string
	AddPubSubNamespace(topicName string) string
		ctx context.Context,
		topicID string,
		payload []byte,
	) error
		ctx context.Context,
		topicIDs []string,
	) error
		ctx context.Context,
	) error
	SubscriptionIDs() map[string]string
		w http.ResponseWriter,
		r *http.Request,
	AddEngagementPubsubNameSpace(topic string) string

ServicePubSub represents logic required to communicate with pubsub

type ServicePubSubMessaging

type ServicePubSubMessaging struct {
	// contains filtered or unexported fields

ServicePubSubMessaging sends "real" (production) notifications

func NewServicePubSubMessaging

func NewServicePubSubMessaging(
	client *pubsub.Client,
	ext extension.BaseExtension,
	db database.Repository,
) (*ServicePubSubMessaging, error)

NewServicePubSubMessaging ...

func (ServicePubSubMessaging) AddEngagementPubsubNameSpace

func (ps ServicePubSubMessaging) AddEngagementPubsubNameSpace(
	topic string,
) string

AddEngagementPubsubNameSpace creates a namespaced topic that resembles the one in engagement service, which is prepended with the word "engagement". This solves the problem where namespaced topics from "onboarding" are different from the ones in engagement. This fix allows for uniformity of topic names between the engagement and onboarding services.

func (ServicePubSubMessaging) AddPubSubNamespace

func (ps ServicePubSubMessaging) AddPubSubNamespace(topicName string) string

AddPubSubNamespace creates a namespaced topic name

func (ServicePubSubMessaging) EnsureSubscriptionsExist

func (ps ServicePubSubMessaging) EnsureSubscriptionsExist(
	ctx context.Context,
) error

EnsureSubscriptionsExist ensures that the subscriptions named in the supplied topic:subscription map exist. If any does not exist, it is created.

func (ServicePubSubMessaging) EnsureTopicsExist

func (ps ServicePubSubMessaging) EnsureTopicsExist(
	ctx context.Context,
	topicIDs []string,
) error

EnsureTopicsExist creates the topic(s) in the suppplied list if they do not already exist.

func (ServicePubSubMessaging) PublishToPubsub

func (ps ServicePubSubMessaging) PublishToPubsub(
	ctx context.Context,
	topicID string,
	payload []byte,
) error

PublishToPubsub sends a message to a specifeid Topic

func (ServicePubSubMessaging) ReceivePubSubPushMessages

func (ps ServicePubSubMessaging) ReceivePubSubPushMessages(
	w http.ResponseWriter,
	r *http.Request,

ReceivePubSubPushMessages receives and processes a Pub/Sub push message.

func (ServicePubSubMessaging) SubscriptionIDs

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

SubscriptionIDs returns a map of topic IDs to subscription IDs

func (ServicePubSubMessaging) TopicIDs

func (ps ServicePubSubMessaging) TopicIDs() []string

TopicIDs returns the known (registered) topic IDs


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL