public void Manager() { var expected = NamespaceManager.CreateFromConnectionString(connection); var bq = new BusQueue(Guid.NewGuid().ToString(), expected, Substitute.For <IBusQueueClient>()); Assert.AreEqual(expected, bq.Manager); }
public LogListener(DatabaseContext context, DiscordClient client, BusQueue busQueue) { _context = context; _client = client; _busQueue = busQueue; }
public void Name() { var expected = Guid.NewGuid().ToString(); var bq = new BusQueue(expected, connection); Assert.AreEqual(expected, bq.Name); }
public bool IsInitQueue(string serviceName) { try { IBusQueue queue = GetQueue(serviceName); if (queue == null) { IServiceConfiguration config = _config.Services.FirstOrDefault(x => x.ServiceName == serviceName); if (config != null) { queue = new BusQueue(_connection, config, _logger); _queueList.Add(queue); } if (queue == null) { return(false); } } return(queue.TryInit()); } catch (Exception e) { _logger?.LogError(e, $"{_config.LocalIP} : {_config.ApplicationName}.{typeof(BusManager).FullName} : {e.Message}"); return(false); } }
/// <summary> /// board passengers /// </summary> /// <param name="addingAmount">count of peoples in generating queue</param> public override List <Passenger.Passenger> BoardPassengers(int addingAmount) { List <Passenger.Passenger> busQueue = new BusQueue(addingAmount).GeneratePassengers(new BusPassengersBuilder()); Passengers.AddRange(BoardBus.Instance().BoardPassenger(Passengers.Count, ref busQueue)); return(busQueue); }
public async Task LockDuration() { var bq = new BusQueue(name, Configuration.ConnectionString); var lockDuration = await bq.LockDuration(); Assert.AreEqual(TimeSpan.FromMinutes(1), lockDuration); }
public ServiceBus(ServiceBusConfig config) { IsRunning = false; Config = config; Production = Array.ConvertAll(config.Production, (x) => NamespaceManager.CreateFromConnectionString(x)); Staging = Array.ConvertAll(config.Staging, (x) => NamespaceManager.CreateFromConnectionString(x)); BusQueue.SetMajorCritical(config.Major, config.Critical); }
public async Task ApproixmateMessageCount() { var bq = new BusQueue(name, Configuration.ConnectionString); var msg = new BrokeredMessage(); await this.sender.Send(msg); var count = await bq.ApproixmateMessageCount(); Assert.AreEqual(1, count); }
public async Task CreateIfNotExists() { var random = new Random(); var name = string.Format("a{0}b", random.Next()); var q = new BusQueue(name, connection); var result = await q.CreateIfNotExists(); Assert.IsTrue(result); result = await q.CreateIfNotExists(); Assert.IsFalse(result); await q.Delete(); }
public void Setup() { var random = new Random(); name = string.Format("a{0}b", random.Next()); var bq = new BusQueue(name, Configuration.ConnectionString); bq.CreateIfNotExists().Wait(); sender = new BusQueueSender(name, Configuration.ConnectionString); reciever = new BusQueueReciever(name, Configuration.ConnectionString); }
public async Task CreateIfNotExists() { var random = new Random(); var name = string.Format("a{0}b", random.Next()); var q = new BusQueue(name, Configuration.ConnectionString); var result = await q.CreateIfNotExists(); Assert.IsTrue(result); result = await q.CreateIfNotExists(); Assert.IsFalse(result); await q.Delete(); }
public QrCodeListener(ILogger <QrCodeListener> logger, IHttpClientFactory httpClientFactory, DiscordClient discordClient, BusQueue busQueue) { _logger = logger; _httpClientFactory = httpClientFactory; _discordClient = discordClient; _busQueue = busQueue; _discordClient.MessageCreated += (_, e) => { OnMessageReceived(e).Forget(); return(Task.CompletedTask); }; }
public async Task Delete() { var bq = new BusQueue(name, Configuration.ConnectionString); await bq.Delete(); var result = await bq.CreateIfNotExists(); Assert.IsTrue(result); await bq.Delete(); result = await bq.CreateIfNotExists(); Assert.IsTrue(result); await bq.Delete(); }
public void TearDown() { var bq = new BusQueue(name, Configuration.ConnectionString); bq.Delete().Wait(); }