【问题标题】:IBM message hub communciation with C# confluent apiIBM 消息中心与 C# confluent api 的通信
【发布时间】:2017-06-30 02:33:59
【问题描述】:

我一直在尝试查找通过 C# Apache Kafka Confluent API 连接到 IBM Message Hub 的文档,但没有成功。 github 上的官方 repo 没有 C# 的示例。有没有人能够使用 C# 与 ibm 消息中心进行通信,如果可以,您可以分享该过程。

谢谢。

更新: 我已成功与 IBM Message Hub 通信。

图书馆:

  1. librdkafka -... 0.11.0-RC2

  2. 证书来自:https://curl.haxx.se/docs/caextract.html

  3. Confluent.kafka.dll Confluent.Kafka 0.11.0-RC1

配置:

private static Dictionary<string, object> constructConfig(string brokerList, bool enableAutoCommit) =>
            new Dictionary<string, object>
            {
                { "group.id", "history" },
                { "enable.auto.commit", enableAutoCommit },
                { "auto.commit.interval.ms", 5000 },
                { "statistics.interval.ms", 60000 },
                { "bootstrap.servers", "ibmserver:port" },
                { "default.topic.config", new Dictionary<string, object>()
                    {
                        { "auto.offset.reset", "smallest" }
                    }
                },
                {"ssl.ca.location",@"E:\cert\cacert.pem" },              
                {"api.version.request","true" },
                {"security.protocol","sasl_ssl" },
                {"sasl.mechanisms","PLAIN" },
                {"sasl.username","xxxx" },
                {"sasl.password","xxxxx" }

            };

.net 版本:4.5.2

希望它能为某人节省时间。

感谢 Edoardo Comar 指导我获取急需的信息。

【问题讨论】:

    标签: c# message-hub


    【解决方案1】:

    我们还没有编写 C# 示例。

    Confluent C# Kafka 客户端是 C 库 librdkafka 的包装器,在 0.9.5 版(撰写本文时的最后一个版本)之前,无法为 Windows 构建具有 SASL_SSL 支持的 Windows,这是身份验证所必需的反对消息中心。

    但是,由于最近的一些提交,librdkafka 0.11(在发布候选版本中,因为我发布了此评论)发生了变化。

    我验证了 librdkafka 0.11(主分支)能够​​通过 Windows 上的 Message Hub 进行身份验证。您将需要设置这些配置属性:

    api.version.request=true
    security.protocol=sasl_ssl
    ssl.ca.location=<path to a valid cert.pem file>
    sasl.mechanisms=PLAIN
    sasl.username=<username from your Bluemix credentials>
    sasl.password=<password from your Bluemix credentials>
    

    我不知道如何在 Windows 中获取有效的 .pem 证书文件,所以我从 macOS 复制了一个 cert.pem 文件(通过 /usr/local/etc/openssl 中的 brew openssl 安装)。来自 Ubuntu 的 cert.pem(在 /etc/openssl 中找到)应该也可以工作。

    祝你好运,请让我了解你的最新进展,

    【讨论】:

    • 谢谢爱德华多。我将处理上述工作并更新此线程的进度。
    • 你的分享可以放在windows的哪个位置,我一直收到错误消息“无法验证经纪人证书:无法获得本地颁发者证书”。
    • 更新:我添加了使用 openssl 生成的 cert.pem 文件的路径。我使用的库是 Confluent.Kafka.dll 版本:0.11.0 预发行版。我收到了 Acessviolation 异常。你能帮忙吗
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    • 1970-01-01
    • 2014-07-25
    • 2016-10-31
    • 2014-01-17
    • 2016-11-10
    • 1970-01-01
    相关资源
    最近更新 更多