Documentation
¶
Index ¶
- Constants
- type ServicePubSub
- type ServicePubSubMessaging
- func (ps ServicePubSubMessaging) AddEngagementPubsubNameSpace(topic string) string
- func (ps ServicePubSubMessaging) AddPubSubNamespace(topicName string) string
- func (ps ServicePubSubMessaging) EnsureSubscriptionsExist(ctx context.Context) error
- func (ps ServicePubSubMessaging) EnsureTopicsExist(ctx context.Context, topicIDs []string) error
- func (ps ServicePubSubMessaging) PublishToPubsub(ctx context.Context, topicID string, payload []byte) error
- func (ps ServicePubSubMessaging) ReceivePubSubPushMessages(w http.ResponseWriter, r *http.Request)
- func (ps ServicePubSubMessaging) SubscriptionIDs() map[string]string
- func (ps ServicePubSubMessaging) TopicIDs() []string
Constants ¶
const ( // ServiceName .. ServiceName = "onboarding" // TopicVersion ... TopicVersion = "v1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServicePubSub ¶
type ServicePubSub interface { // Ask the notification service about the topics that it knows about TopicIDs() []string AddPubSubNamespace(topicName string) string PublishToPubsub( ctx context.Context, topicID string, payload []byte, ) error EnsureTopicsExist( ctx context.Context, topicIDs []string, ) error EnsureSubscriptionsExist( ctx context.Context, ) error SubscriptionIDs() map[string]string ReceivePubSubPushMessages( 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