/// <summary> /// Use this constructor with DependencyInjection. Config's values are only used for RabbitService-esque settings and for building of Consumers. /// </summary> /// <param name="config"></param> /// <param name="channelPool"></param> /// <param name="autoPublisher"></param> /// <param name="toploger"></param> /// <param name="loggerFactory"></param> public RabbitService(Config config, IChannelPool channelPool, IAutoPublisher autoPublisher, ITopologer toploger, ILoggerFactory loggerFactory = null) { LogHelper.LoggerFactory = loggerFactory; Config = config; ChannelPool = channelPool; AutoPublisher = autoPublisher; Topologer = toploger; BuildConsumers(); }
public RabbitFixture() { CompressionProvider = new GzipProvider(); HashingProvider = new Argon2ID_HashingProvider(); HashKey = HashingProvider.GetHashKey(Passphrase, Salt, 32); EncryptionProvider = new AesGcmEncryptionProvider(HashKey); SerializationProvider = new Utf8JsonProvider(); Options = JsonFileReader.ReadFileAsync <RabbitOptions>("RabbitMQ\\TestConfig.json").GetAwaiter().GetResult(); RabbitService = new RabbitService( Options, SerializationProvider, EncryptionProvider, CompressionProvider, LoggerFactory .Create( builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information))); ChannelPool = RabbitService.ChannelPool; Topologer = RabbitService.Topologer; Publisher = RabbitService.Publisher; }