+
+func validateConfiguration(configuration *config.Config) error {
+ if configuration.InfoProducerHost == "" {
+ return fmt.Errorf("missing INFO_PRODUCER_HOST")
+ }
+ return nil
+}
+
+func registerTypesAndProducer(jobHandler jobs.JobTypeHandler, infoCoordinatorAddress string, callbackAddress string) error {
+ registrator := config.NewRegistratorImpl(infoCoordinatorAddress, retryClient)
+ if types, err := jobHandler.GetTypes(); err == nil {
+ if regErr := registrator.RegisterTypes(types); regErr != nil {
+ return fmt.Errorf("unable to register all types due to: %v", regErr)
+ }
+ } else {
+ return fmt.Errorf("unable to get types to register due to: %v", err)
+ }
+ producer := config.ProducerRegistrationInfo{
+ InfoProducerSupervisionCallbackUrl: callbackAddress + server.StatusPath,
+ SupportedInfoTypes: jobHandler.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
+}