in src/Epam.Kafka.PubSub/Common/PubSubContext.cs [59:97]
internal void AddReplication(string name)
{
lock (this._syncObj)
{
if (this._replications.Contains(name))
{
throw new InvalidOperationException($"Replication with name '{name}' already added.");
}
if (this._subscriptions.ContainsKey(name))
{
throw new InvalidOperationException($"Replication with name '{name}' cannot be added because name already used by Subscription.");
}
if (this._publications.ContainsKey(name))
{
throw new InvalidOperationException($"Replication with name '{name}' cannot be added because name already used by Publication.");
}
if (!RegexHelper.PunSubNameRegex.IsMatch(name))
{
throw new InvalidOperationException(
$"Replication name '{name}' not match '{RegexHelper.PunSubNameRegex}'.");
}
try
{
this.AddSubscription(name);
}
catch (InvalidOperationException e)
{
throw new InvalidOperationException(
$"Replication with name '{name}' cannot be added because related subscription cannot be added. See inner exception for details",
e);
}
this._replications.Add(name);
}
}