+ if configuration.ProducerCertPath == "" || configuration.ProducerKeyPath == "" {
+ return fmt.Errorf("missing PRODUCER_CERT and/or PRODUCER_KEY")
+ }
+ if configuration.DMaaPMRAddress == "" && configuration.KafkaBootstrapServers == "" {
+ return fmt.Errorf("at least one of DMAAP_MR_ADDR or KAFKA_BOOTSRAP_SERVERS must be provided")
+ }
+ return nil
+}
+func registerTypesAndProducer(jobTypesManager jobs.JobTypesManager, infoCoordinatorAddress string, callbackAddress string, client restclient.HTTPClient) error {
+ registrator := config.NewRegistratorImpl(infoCoordinatorAddress, client)
+ configTypes, err := config.GetJobTypesFromConfiguration("configs")
+ if err != nil {
+ return fmt.Errorf("unable to register all types due to: %v", err)
+ }
+ regErr := registrator.RegisterTypes(jobTypesManager.LoadTypesFromConfiguration(configTypes))
+ if regErr != nil {
+ return fmt.Errorf("unable to register all types due to: %v", regErr)
+ }
+
+ producer := config.ProducerRegistrationInfo{
+ InfoProducerSupervisionCallbackUrl: callbackAddress + server.HealthCheckPath,
+ SupportedInfoTypes: jobTypesManager.GetSupportedTypes(),
+ InfoJobCallbackUrl: callbackAddress + server.AddJobPath,
+ }
+ if err := registrator.RegisterProducer("DMaaP_Mediator_Producer", &producer); err != nil {
+ return fmt.Errorf("unable to register producer due to: %v", err)
+ }
+ return nil
+}