Documentation ¶
Index ¶
- Constants
- type ServicePubSubMessaging
- func (ps ServicePubSubMessaging) AddPubSubNamespace(topicName string, ServiceName string) string
- func (ps ServicePubSubMessaging) EnsureSubscriptionsExist(ctx context.Context) error
- func (ps ServicePubSubMessaging) EnsureTopicsExist(ctx context.Context, topicIDs []string) error
- func (ps ServicePubSubMessaging) NotifyCMSAddFacilityToProgram(ctx context.Context, payload *dto.CMSLinkFacilityToProgramPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateAllergy(ctx context.Context, allergy *dto.PatientAllergyOutput) error
- func (ps ServicePubSubMessaging) NotifyCreateCMSClient(ctx context.Context, user *dto.PubsubCreateCMSClientPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateCMSFacility(ctx context.Context, facility *dto.CreateCMSFacilityPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateCMSOrganisation(ctx context.Context, organisation *dto.CreateCMSOrganisationPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateCMSProgram(ctx context.Context, program *dto.CreateCMSProgramPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateClinicalTenant(ctx context.Context, tenant *dto.ClinicalTenantPayload) error
- func (ps ServicePubSubMessaging) NotifyCreateMedication(ctx context.Context, medication *dto.PatientMedicationOutput) error
- func (ps ServicePubSubMessaging) NotifyCreateOrganization(ctx context.Context, facility *domain.Facility) error
- func (ps ServicePubSubMessaging) NotifyCreatePatient(ctx context.Context, client *dto.PatientCreationOutput) error
- func (ps ServicePubSubMessaging) NotifyCreateTestOrder(ctx context.Context, testOrder *dto.PatientTestOrderOutput) error
- func (ps ServicePubSubMessaging) NotifyCreateTestResult(ctx context.Context, testResult *dto.PatientTestResultOutput) error
- func (ps ServicePubSubMessaging) NotifyCreateVitals(ctx context.Context, vitals *dto.PatientVitalSignOutput) error
- func (ps ServicePubSubMessaging) NotifyDeleteCMSClient(ctx context.Context, user *dto.DeleteCMSUserPayload) error
- func (ps ServicePubSubMessaging) NotifyRegisterMatrixUser(ctx context.Context, payload *dto.MatrixUserRegistrationPayload) error
- func (ps ServicePubSubMessaging) PublishToPubsub(ctx context.Context, topicID, serviceName 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
- type ServicePubsub
Constants ¶
const ( // ClinicalServiceName defines the service where the topic is created ClinicalServiceName = "clinical" // MyCareHubServiceName defines the service where some of the topics have been created MyCareHubServiceName = "mycarehub" // TopicVersion defines the topic version. That standard one is `v1` TopicVersion = "v2" // HostNameEnvVarName defines the host name HostNameEnvVarName = "SERVICE_HOST" // TestTopicName is a topic that is used for testing purposes TestTopicName = "pubsub.mycarehub.testing.topic" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServicePubSubMessaging ¶
type ServicePubSubMessaging struct { BaseExt extension.ExternalMethodsExtension Query infrastructure.Query Update infrastructure.Update FCM fcm.ServiceFCM Matrix serviceMatrix.Matrix // contains filtered or unexported fields }
ServicePubSubMessaging is used to send and receive pubsub notifications
func NewServicePubSubMessaging ¶
func NewServicePubSubMessaging( baseExt extension.ExternalMethodsExtension, query infrastructure.Query, update infrastructure.Update, fcm fcm.ServiceFCM, matrix serviceMatrix.Matrix, ) (*ServicePubSubMessaging, error)
NewServicePubSubMessaging returns a new instance of pubsub
func (ServicePubSubMessaging) AddPubSubNamespace ¶
func (ps ServicePubSubMessaging) AddPubSubNamespace(topicName string, ServiceName string) string
AddPubSubNamespace creates unique topics. The topics will be in the form <service name>-<topicName>-<environment>-v1
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 supplied list if they do not exist
func (ServicePubSubMessaging) NotifyCMSAddFacilityToProgram ¶
func (ps ServicePubSubMessaging) NotifyCMSAddFacilityToProgram(ctx context.Context, payload *dto.CMSLinkFacilityToProgramPayload) error
NotifyCMSAddFacilityToProgram publishes to the add facility to program topic and the facility will be added to the program in the CMS.
func (ServicePubSubMessaging) NotifyCreateAllergy ¶
func (ps ServicePubSubMessaging) NotifyCreateAllergy(ctx context.Context, allergy *dto.PatientAllergyOutput) error
NotifyCreateAllergy publishes to the create allergy topic
func (ServicePubSubMessaging) NotifyCreateCMSClient ¶
func (ps ServicePubSubMessaging) NotifyCreateCMSClient(ctx context.Context, user *dto.PubsubCreateCMSClientPayload) error
NotifyCreateCMSClient publishes to the create cms user topic and the user will be created in the CMS system
func (ServicePubSubMessaging) NotifyCreateCMSFacility ¶
func (ps ServicePubSubMessaging) NotifyCreateCMSFacility(ctx context.Context, facility *dto.CreateCMSFacilityPayload) error
NotifyCreateCMSFacility publishes to the create cms facility topic and the facility will be created in the CMS.
func (ServicePubSubMessaging) NotifyCreateCMSOrganisation ¶
func (ps ServicePubSubMessaging) NotifyCreateCMSOrganisation(ctx context.Context, organisation *dto.CreateCMSOrganisationPayload) error
NotifyCreateCMSOrganisation publishes to the create cms organisation topic and the organisation will be created in the CMS.
func (ServicePubSubMessaging) NotifyCreateCMSProgram ¶
func (ps ServicePubSubMessaging) NotifyCreateCMSProgram(ctx context.Context, program *dto.CreateCMSProgramPayload) error
NotifyCreateCMSProgram publishes to the create cms program topic and the program will be created in the CMS.
func (ServicePubSubMessaging) NotifyCreateClinicalTenant ¶
func (ps ServicePubSubMessaging) NotifyCreateClinicalTenant(ctx context.Context, tenant *dto.ClinicalTenantPayload) error
NotifyCreateClinicalTenant publishes to clinical `create-tenant` topic to create a topic in that service
func (ServicePubSubMessaging) NotifyCreateMedication ¶
func (ps ServicePubSubMessaging) NotifyCreateMedication(ctx context.Context, medication *dto.PatientMedicationOutput) error
NotifyCreateMedication publishes to the create medication topic
func (ServicePubSubMessaging) NotifyCreateOrganization ¶
func (ps ServicePubSubMessaging) NotifyCreateOrganization(ctx context.Context, facility *domain.Facility) error
NotifyCreateOrganization publishes to the create organisation topic the facilities without a FHIR organisation ID
func (ServicePubSubMessaging) NotifyCreatePatient ¶
func (ps ServicePubSubMessaging) NotifyCreatePatient(ctx context.Context, client *dto.PatientCreationOutput) error
NotifyCreatePatient publishes to the create patient topic
func (ServicePubSubMessaging) NotifyCreateTestOrder ¶
func (ps ServicePubSubMessaging) NotifyCreateTestOrder(ctx context.Context, testOrder *dto.PatientTestOrderOutput) error
NotifyCreateTestOrder publishes to the create test order topic
func (ServicePubSubMessaging) NotifyCreateTestResult ¶
func (ps ServicePubSubMessaging) NotifyCreateTestResult(ctx context.Context, testResult *dto.PatientTestResultOutput) error
NotifyCreateTestResult publishes to the create test result topic
func (ServicePubSubMessaging) NotifyCreateVitals ¶
func (ps ServicePubSubMessaging) NotifyCreateVitals(ctx context.Context, vitals *dto.PatientVitalSignOutput) error
NotifyCreateVitals publishes to the create vitals topic
func (ServicePubSubMessaging) NotifyDeleteCMSClient ¶
func (ps ServicePubSubMessaging) NotifyDeleteCMSClient(ctx context.Context, user *dto.DeleteCMSUserPayload) error
NotifyDeleteCMSClient publishes to the delete cms user topic and the user will be deleted in the CMS.
func (ServicePubSubMessaging) NotifyRegisterMatrixUser ¶
func (ps ServicePubSubMessaging) NotifyRegisterMatrixUser(ctx context.Context, payload *dto.MatrixUserRegistrationPayload) error
NotifyRegisterMatrixUser publishes to mycarehub `mycarehub.matrixuser.register` topic to create a topic in that service
func (ServicePubSubMessaging) PublishToPubsub ¶
func (ps ServicePubSubMessaging) PublishToPubsub( ctx context.Context, topicID, serviceName string, payload []byte, ) error
PublishToPubsub publishes a message to a specified topic
func (ServicePubSubMessaging) ReceivePubSubPushMessages ¶
func (ps ServicePubSubMessaging) ReceivePubSubPushMessages( w http.ResponseWriter, r *http.Request, )
ReceivePubSubPushMessages receives and processes a pubsub 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
type ServicePubsub ¶
type ServicePubsub interface { PublishToPubsub( ctx context.Context, topicID string, serviceName string, payload []byte, ) error ReceivePubSubPushMessages( w http.ResponseWriter, r *http.Request, ) NotifyCreatePatient(ctx context.Context, client *dto.PatientCreationOutput) error NotifyCreateVitals(ctx context.Context, vitals *dto.PatientVitalSignOutput) error NotifyCreateAllergy(ctx context.Context, allergy *dto.PatientAllergyOutput) error NotifyCreateMedication(ctx context.Context, medication *dto.PatientMedicationOutput) error NotifyCreateTestOrder(ctx context.Context, testOrder *dto.PatientTestOrderOutput) error NotifyCreateTestResult(ctx context.Context, testResult *dto.PatientTestResultOutput) error NotifyCreateOrganization(ctx context.Context, facility *domain.Facility) error NotifyCreateCMSClient(ctx context.Context, user *dto.PubsubCreateCMSClientPayload) error NotifyDeleteCMSClient(ctx context.Context, user *dto.DeleteCMSUserPayload) error NotifyCreateCMSProgram(ctx context.Context, program *dto.CreateCMSProgramPayload) error NotifyCreateCMSOrganisation(ctx context.Context, program *dto.CreateCMSOrganisationPayload) error NotifyCreateCMSFacility(ctx context.Context, facility *dto.CreateCMSFacilityPayload) error NotifyCMSAddFacilityToProgram(ctx context.Context, program *dto.CMSLinkFacilityToProgramPayload) error NotifyCreateClinicalTenant(ctx context.Context, tenant *dto.ClinicalTenantPayload) error NotifyRegisterMatrixUser(ctx context.Context, payload *dto.MatrixUserRegistrationPayload) error }
ServicePubsub represent all the logic required to interact with pubsub