示例#1
0
        public void WhenIPublishValidDeviceFirmwareInfoToKafkaTopic()
        {
            if (IsCellular)
            {
                DeviceServiceConfig.DeviceFirmwareKafkaTopic = ConfigurationManager.AppSettings["CellularFirmwareKafkaTopic"];
            }

            if (IsNetwork)
            {
                DeviceServiceConfig.DeviceFirmwareKafkaTopic = ConfigurationManager.AppSettings["NetworkManagerFirmwareKafkaTopic"];
            }

            if (IsSatellite)
            {
                DeviceServiceConfig.DeviceFirmwareKafkaTopic = ConfigurationManager.AppSettings["SatelliteRadioFirmwarePartNUmber"];
            }

            KafkaServicesConfig.InitializeKafkaProducer(DeviceServiceConfig.DeviceFirmwareKafkaTopic);
            try
            {
                KafkaServicesConfig.ProduceMessage(Payload, DeviceUID);
            }
            catch (Exception e)
            {
                throw new Exception("Unable To publish in kafka", e);
            }
        }
示例#2
0
 public static void InitializeKafka()
 {
     if (FeatureContext.Current.FeatureInfo.Title.Equals("CustomerAssetService"))
     {
         KafkaServicesConfig.InitializeKafkaConsumer(customerAssetServiceSupport);
     }
 }
示例#3
0
 public void WhenIPublishToKafkaTopic(string Topic)
 {
     Topic = DeviceServiceConfig.DeviceDetailKafkaTopic;
     KafkaServicesConfig.InitializeKafkaProducer(Topic);
     //LogResult.Report(Log, "log_ForInfo", "Posting the AssetStatusEvent request with Valid Values: " + payload);
     try
     {
         KafkaServicesConfig.ProduceMessage(Payload, DeviceSerialNumber);
     }
     catch (Exception e)
     {
         throw new Exception("Unable To publish in kafka", e);
     }
 }
示例#4
0
        public void ProduceKafkaMessage(string topic)
        {
            Console.WriteLine("Topic to publish : " + topic);
            KafkaServicesConfig.InitializeKafkaProducer(topic);

            try
            {
                if (MakeCodeModel == null)
                {
                    LogResult.Report(Log, "log_ForInfo", topic + ": MakeCode Model for payload is null");
                    throw new Exception("MakeCode Model is null");
                }
                else
                {
                    if (MakeCodeModel.MakeUID == null)
                    {
                        LogResult.Report(Log, "log_ForInfo", topic + ": MakeCodeUID for payload is null");
                        throw new Exception("MakeCodeUid is null");
                    }
                    else
                    {
                        Console.WriteLine(topic + ": Asset Details OK, proceed publish.");
                        LogResult.Report(Log, "log_ForInfo", topic + ": Asset Details OK, proceed publish.");
                    }
                }

                //else
                //  Console.WriteLine("Asset detail not null"+AssetDetail);
                //else
                //  Console.WriteLine("Asset detail uid not null",AssetDetail.AssetUid);

                KafkaServicesConfig.ProduceMessage(Payload, MakeCodeModel?.MakeUID.ToString());
            }
            catch (Exception e)
            {
                throw new Exception("Unable To publish in kafka", e);
            }
        }