本文整理汇总了C#中Raven.Database.Bundles.SqlReplication.SqlReplicationConfig.GetElasticClient方法的典型用法代码示例。如果您正苦于以下问题:C# SqlReplicationConfig.GetElasticClient方法的具体用法?C# SqlReplicationConfig.GetElasticClient怎么用?C# SqlReplicationConfig.GetElasticClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Database.Bundles.SqlReplication.SqlReplicationConfig
的用法示例。
在下文中一共展示了SqlReplicationConfig.GetElasticClient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElasticsearchDestinationWriter
public ElasticsearchDestinationWriter(DocumentDatabase database, SqlReplicationConfig _cfg, SqlReplicationStatistics replicationStatistics)
{
var cfg = new ElasticsearchReplicationConfig(_cfg);
this.database = database;
this.cfg = cfg;
this.targetIndexName = cfg.FactoryName.ToLowerInvariant(); // Elasticsearch requires all index names to be lowercased
this.replicationStatistics = replicationStatistics;
try
{
elasticsearchClient = cfg.GetElasticClient();
}
catch (UriFormatException e)
{
if (database != null)
database.AddAlert(new Alert
{
AlertLevel = AlertLevel.Error,
CreatedAt = SystemTime.UtcNow,
Exception = e.ToString(),
Title = "Invalid Elasticsearch URL provided",
Message = "Elasticsearch Replication could not parse one of the provided node URLs",
UniqueKey = "Elasticsearch Replication Connection Error: " + cfg.ConnectionString
});
}
catch (Exception e)
{
if (database != null)
database.AddAlert(new Alert
{
AlertLevel = AlertLevel.Error,
CreatedAt = SystemTime.UtcNow,
Exception = e.ToString(),
Title = "Elasticsearch Replication could not open connection",
Message = "Elasticsearch Replication could not open connection to " + cfg.ConnectionString,
UniqueKey = "Elasticsearch Replication Connection Error: " + cfg.ConnectionString
});
throw;
}
}
开发者ID:synhershko,项目名称:RavenDB.ElasticsearchReplication,代码行数:41,代码来源:ElasticsearchDestinationWriter.cs