Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 与卡夫卡的证书颁发_C#_Apache Kafka_Aws Lambda - Fatal编程技术网

C# 与卡夫卡的证书颁发

C# 与卡夫卡的证书颁发,c#,apache-kafka,aws-lambda,C#,Apache Kafka,Aws Lambda,我在AWS中用C#编写了一个lambda函数,它试图发布关于卡夫卡主题的消息。 但是,在发布消息时,我会间歇性地出现以下错误 ssl.ca.location失败:by_file.c:260:错误:0B084009:x509证书例程:x509_load_cert_crl_file:PEM lib::invalidoOperationException public async Task WorkOrderEventHandler(SQSEvent workOrderEvent, ILambdaCo

我在AWS中用C#编写了一个lambda函数,它试图发布关于卡夫卡主题的消息。 但是,在发布消息时,我会间歇性地出现以下错误

ssl.ca.location失败:by_file.c:260:错误:0B084009:x509证书例程:x509_load_cert_crl_file:PEM lib::invalidoOperationException

public async Task WorkOrderEventHandler(SQSEvent workOrderEvent, ILambdaContext context)
        {
            if (!(File.Exists("/tmp/combined.pem") && File.Exists("/tmp/ca-cert.pem") && File.Exists("/tmp/cert.cer")))
            {
                Console.WriteLine("Certificates not found");
                DownloadCertificates();
            }

            var producerConfig = new ProducerConfig
            {
                SslKeyLocation = "/tmp/combined.pem",
                SslCaLocation = "/tmp/ca-cert.pem",
                SslCertificateLocation = "/tmp/cert.cer",
                BootstrapServers = _bootStrapServers,
                SecurityProtocol = SecurityProtocol.Ssl
            };

            Console.WriteLine($"processing message {workOrderEvent.Records.First().Body}");

            using var producer = new ProducerBuilder<Null, string>(producerConfig).Build();


            foreach (var message in workOrderEvent.Records)
            {
                await ProcessMessageAsync(producer, message, context);
            }
        }
public异步任务workOrderEvent处理器(SQSEvent workOrderEvent,ilambdac上下文)
{
如果(!(File.Exists(“/tmp/combined.pem”)&&File.Exists(“/tmp/ca-cert.pem”)&&File.Exists(“/tmp/cert.cer”))
{
Console.WriteLine(“未找到证书”);
下载证书();
}
var PRODUCTERCONFIG=新PRODUCTERCONFIG
{
SslKeyLocation=“/tmp/combined.pem”,
SSLCAPLOCATION=“/tmp/ca-cert.pem”,
SslCertificateLocation=“/tmp/cert.cer”,
bootstrapserver=\u bootstrapserver,
SecurityProtocol=SecurityProtocol.Ssl
};
WriteLine($“正在处理消息{workOrderEvent.Records.First().Body}”);
使用var producer=new ProducerBuilder(producerConfig.Build();
foreach(workOrderEvent.Records中的var消息)
{
等待ProcessMessageAsync(生产者、消息、上下文);
}
}
我已经将前面lambda的function()方法中的证书从S3下载到lambda可用的/tmp文件夹中

大多数情况下,出版业运作良好,但也有几次失败,原因不明