32 lines
889 B
C#
32 lines
889 B
C#
using xCommons.Extensions;
|
|
using xExceptions.Constants;
|
|
using xEventService.Extensions;
|
|
using xEventService.Interfaces;
|
|
using xEventService.Configuration;
|
|
|
|
namespace xEventService.Providers
|
|
{
|
|
public class XKafkaProducerService : IXKafkaProducerService
|
|
{
|
|
private readonly IProducer<Null, string> producer;
|
|
private readonly ILogger<RpkKafkaProducerService> logger;
|
|
|
|
public XKafkaProducerService(
|
|
ILoggeer<XKafkaProducerService> logger,
|
|
XEventServiceConfiguration configuration
|
|
)
|
|
{
|
|
//
|
|
this.logger = logger;
|
|
|
|
//
|
|
// Validate Configurations ...
|
|
if (!configuration.IsValid() ||
|
|
configuration.Broker != Constants.XEventBroker.XKafka
|
|
)
|
|
{
|
|
XException.InvalidConfiguration.Throw();
|
|
}
|
|
}
|
|
}
|
|
} |