Example #1
0
    static ProducerConfig ConfigurationCustomizer(ProducerConfig config)
    {
        AzureEventHubsHelper.TrySetConnectionInfo(config.BootstrapServers, info =>
        {
            config.BootstrapServers = info.BootstrapServers;
            config.SaslUsername     = info.SaslUsername;
            config.SaslPassword     = info.SaslPassword;
        });

        return(config);
    }
Example #2
0
    public void TestEventHubsHelper()
    {
        string bootstrapServers = null;
        string username         = null;
        string password         = null;

        AzureEventHubsHelper.TrySetConnectionInfo("Endpoint=sb://ongo-bongo.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaw=",
                                                  info =>
        {
            bootstrapServers = info.BootstrapServers;
            username         = info.SaslUsername;
            password         = info.SaslPassword;
        });

        Assert.That(bootstrapServers, Is.EqualTo("ongo-bongo.servicebus.windows.net:9093"));
        Assert.That(username, Is.EqualTo("$ConnectionString"));
        Assert.That(password, Is.EqualTo("Endpoint=sb://ongo-bongo.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaw="));
    }