public async Task CreateTopologyFromPartialFileAsync() { var config = await ConfigReader.ConfigFileReadAsync("TestConfig.json"); var top = new Topologer(config); await top .CreateTopologyFromFileAsync("TestPartialTopologyConfig.json") .ConfigureAwait(false); }
public ConsumerTests(ITestOutputHelper output) { this.output = output; config = ConfigReader.ConfigFileReadAsync("TestConfig.json").GetAwaiter().GetResult(); channelPool = new ChannelPool(config); topologer = new Topologer(config); rabbitService = new RabbitService("Config.json", null, null, null, null); }
public async Task CreateConsumerAndInitializeChannelPool() { var config = await ConfigReader.ConfigFileReadAsync("TestConfig.json"); Assert.NotNull(config); var con = new Consumer(config, "TestMessageConsumer"); Assert.NotNull(con); }
public PublisherConsumerTests(ITestOutputHelper output) { this.output = output; config = ConfigReader.ConfigFileReadAsync("TestConfig.json").GetAwaiter().GetResult(); var channelPool = new ChannelPool(config); topologer = new Topologer(channelPool); publisher = new Publisher(channelPool, new byte[] { }); consumer = new Consumer(channelPool, "TestAutoPublisherConsumerName"); }
/// <summary> /// Reads config from a provided file name path. Builds out a RabbitService with instantiated dependencies based on config settings. /// </summary> /// <param name="fileNamePath"></param> /// <param name="passphrase"></param> /// <param name="salt"></param> /// <param name="loggerFactory"></param> /// <param name="processReceiptAsync"></param> public RabbitService(string fileNamePath, string passphrase, string salt, ILoggerFactory loggerFactory = null, Func <PublishReceipt, ValueTask> processReceiptAsync = null) : this( ConfigReader .ConfigFileReadAsync(fileNamePath) .GetAwaiter() .GetResult(), passphrase, salt, loggerFactory, processReceiptAsync) { }
public AutoPublisherConsumerTests(ITestOutputHelper output) { this.output = output; config = ConfigReader.ConfigFileReadAsync("Config.json").GetAwaiter().GetResult(); var channelPool = new ChannelPool(config); topologer = new Topologer(channelPool); topologer.InitializeAsync().GetAwaiter().GetResult(); autoPublisher = new AutoPublisher(channelPool); consumer = new Consumer(channelPool, "ConsumerFromConfig"); }
private static async Task SetupAsync() { var sw = Stopwatch.StartNew(); config = await ConfigReader.ConfigFileReadAsync("Config.json"); channelPool = new ChannelPool(config); topologer = new Topologer(channelPool); apub1 = new Publisher(channelPool, new byte[] { }); apub2 = new Publisher(channelPool, new byte[] { }); apub3 = new Publisher(channelPool, new byte[] { }); apub4 = new Publisher(channelPool, new byte[] { }); await Console.Out.WriteLineAsync("- Creating stress test queues!").ConfigureAwait(false); foreach (var kvp in config.ConsumerSettings) { await topologer .DeleteQueueAsync(kvp.Value.QueueName) .ConfigureAwait(false); } foreach (var kvp in config.ConsumerSettings) { await topologer .CreateQueueAsync(kvp.Value.QueueName, true) .ConfigureAwait(false); } await apub1.StartAutoPublishAsync().ConfigureAwait(false); await apub2.StartAutoPublishAsync().ConfigureAwait(false); await apub3.StartAutoPublishAsync().ConfigureAwait(false); await apub4.StartAutoPublishAsync().ConfigureAwait(false); con1 = new Consumer(channelPool, "Consumer1"); con2 = new Consumer(channelPool, "Consumer2"); con3 = new Consumer(channelPool, "Consumer3"); con4 = new Consumer(channelPool, "Consumer4"); sw.Stop(); await Console .Out .WriteLineAsync($"- Setup has finished in {sw.ElapsedMilliseconds} ms.") .ConfigureAwait(false); }
/// <summary> /// Reads config from a provided file name path. Builds out a RabbitService with instantiated dependencies based on config settings. /// </summary> /// <param name="fileNamePath"></param> /// <param name="loggerFactory"></param> public RabbitService(string fileNamePath, ILoggerFactory loggerFactory = null) { LogHelper.LoggerFactory = loggerFactory; Config = ConfigReader .ConfigFileReadAsync(fileNamePath) .GetAwaiter() .GetResult(); ChannelPool = new ChannelPool(Config); AutoPublisher = new AutoPublisher(ChannelPool); Topologer = new Topologer(ChannelPool); BuildConsumers(); }