dotnet-cqrs/Svrnty.CQRS.Events.ConsumerGroups/PostgreSQL/PostgresConsumerGroupOptions.cs

39 lines
1.1 KiB
C#

using System;
namespace Svrnty.CQRS.Events.ConsumerGroups.PostgreSQL;
/// <summary>
/// Configuration options for PostgreSQL consumer group storage.
/// </summary>
public class PostgresConsumerGroupOptions
{
/// <summary>
/// PostgreSQL connection string.
/// </summary>
public string ConnectionString { get; set; } = string.Empty;
/// <summary>
/// Database schema name for consumer group tables.
/// Default: event_streaming
/// </summary>
public string SchemaName { get; set; } = "event_streaming";
/// <summary>
/// Whether to automatically run migrations on startup.
/// Default: true
/// </summary>
public bool AutoMigrate { get; set; } = true;
/// <summary>
/// Validates the configuration.
/// </summary>
public void Validate()
{
if (string.IsNullOrWhiteSpace(ConnectionString))
throw new ArgumentException("ConnectionString cannot be null or whitespace", nameof(ConnectionString));
if (string.IsNullOrWhiteSpace(SchemaName))
throw new ArgumentException("SchemaName cannot be null or whitespace", nameof(SchemaName));
}
}