pubsubmessaging

package
Version: v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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

	// Publishers
	EDIMemberCoverLinking(ctx context.Context, data dto.LinkCoverPubSubMessage) error
	NotifyCreateContact(ctx context.Context, contact domain.CRMContact) error
	NotifyCoverLinking(ctx context.Context, data dto.LinkCoverPubSubMessage) error
	NotifyUpdateContact(
		ctx context.Context,
		contact domain.CRMContact,
	) error
	NotifyCreateCustomer(
		ctx context.Context,
		data dto.CustomerPubSubMessage,
	) error
	NotifyCreateSupplier(
		ctx context.Context,
		data dto.SupplierPubSubMessage,
	) error
}

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

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) EDIMemberCoverLinking added in v0.0.23

func (ps *ServicePubSubMessaging) EDIMemberCoverLinking(
	ctx context.Context,
	data dto.LinkCoverPubSubMessage,
) error

EDIMemberCoverLinking publishes to the edi.covers.link topic. The reason for this is to Auto-link the Sladers who get text messages from EDI. If a slader is converted and creates an account on Be.Well app, we should automatically append a cover to their profile.

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) NotifyCoverLinking

func (ps *ServicePubSubMessaging) NotifyCoverLinking(
	ctx context.Context,
	data dto.LinkCoverPubSubMessage,
) error

NotifyCoverLinking pushes to covers.link topic

func (*ServicePubSubMessaging) NotifyCreateContact

func (ps *ServicePubSubMessaging) NotifyCreateContact(
	ctx context.Context,
	contact domain.CRMContact,
) error

NotifyCreateContact publishes to crm.contact.create topic

func (*ServicePubSubMessaging) NotifyCreateCustomer

func (ps *ServicePubSubMessaging) NotifyCreateCustomer(
	ctx context.Context,
	data dto.CustomerPubSubMessage,
) error

NotifyCreateCustomer publishes to customers.create topic

func (*ServicePubSubMessaging) NotifyCreateSupplier

func (ps *ServicePubSubMessaging) NotifyCreateSupplier(
	ctx context.Context,
	data dto.SupplierPubSubMessage,
) error

NotifyCreateSupplier publishes to suppliers.create topic

func (*ServicePubSubMessaging) NotifyUpdateContact

func (ps *ServicePubSubMessaging) NotifyUpdateContact(
	ctx context.Context,
	contact domain.CRMContact,
) error

NotifyUpdateContact publishes to crm.contact.update topic

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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