Esempio n. 1
0
        public async Task Create_New_Material_With_Valid_Data_Must_Be_Success()
        {
            var moq    = MockHelper.MoqCreateMaterialBindingModel();
            var result = await _materialService.AddAsync(moq);

            Assert.True(Guid.TryParse(result, out _));
        }
Esempio n. 2
0
        public void ConfluentCloudStringTrigger(
            [KafkaTrigger(
                 "KafkaBrokerUrl",
                 "materials",
                 ConsumerGroup = "cg-01",
                 Protocol = BrokerProtocol.SaslSsl,
                 AuthenticationMode = BrokerAuthenticationMode.Plain,
                 Username = "******",
                 Password = "******",
                 SslCaLocation = "confluent_cloud_cacert.pem")]
            KafkaEventData <string> kafkaEvent,
            ILogger logger)
        {
            string kafkaEventValue = kafkaEvent.Value.ToString();

            try
            {
                JObject obj = JObject.Parse(kafkaEventValue);
                _materialService.AddAsync(obj);
            }
            catch (JsonReaderException ex)
            {
                //TODO: add retries and handle the commit of the Kafka event
                logger.LogError(ex, "The Kafka event value [{kafkaEventValue}] is not valid");
            }
        }