async Task ReadBatch() { #region ReadDelayedBatch var manager = new DelayedQueueManager("endpointTable", sqlConnection); var result = await manager.Read( size : 5, startRowVersion : 10, action : async message => { Console.WriteLine(message.Headers); if (message.Body == null) { return; } using var reader = new StreamReader(message.Body); var bodyText = await reader.ReadToEndAsync(); Console.WriteLine(bodyText); }); Console.WriteLine(result.Count); Console.WriteLine(result.LastRowVersion); #endregion }
public DelayedReaderTests() { var manager = new DelayedQueueManager(table, SqlConnection); manager.Drop().Await(); manager.Create().Await(); }
async Task SendBatch() { string headers1 = null; byte[] body1 = null; string headers2 = null; byte[] body2 = null; #region SendDelayedBatch var queueManager = new DelayedQueueManager("endpointTable.Delayed", sqlConnection); var messages = new List <OutgoingDelayedMessage> { new OutgoingDelayedMessage( due: DateTime.UtcNow.AddDays(1), headers: headers1, bodyBytes: body1), new OutgoingDelayedMessage( due: DateTime.UtcNow.AddDays(1), headers: headers2, bodyBytes: body2), }; await queueManager.Send(messages) .ConfigureAwait(false); #endregion }
async Task ReadBatch() { #region ReadDelayedBatch var queueManager = new DelayedQueueManager("endpointTable", sqlConnection); var result = await queueManager.Read( size : 5, startRowVersion : 10, action : async message => { Console.WriteLine(message.Headers); using (var reader = new StreamReader(message.Body)) { var bodyText = await reader.ReadToEndAsync() .ConfigureAwait(false); Console.WriteLine(bodyText); } }) .ConfigureAwait(false); Console.WriteLine(result.Count); Console.WriteLine(result.LastRowVersion); #endregion }
public async Task Single() { await DelayedTestDataBuilder.SendData(table); var reader = new DelayedQueueManager(table, SqlConnection); await using var result = await reader.Read(1); await Verify(result !.ToVerifyTarget()); }
async Task CreateQueue() { #region CreateDelayedQueue var queueManager = new DelayedQueueManager("endpointTable.Delayed", sqlConnection); await queueManager.Create().ConfigureAwait(false); #endregion }
async Task DeleteQueue() { #region DeleteDelayedQueue var manager = new DelayedQueueManager("endpointTable.Delayed", sqlConnection); await manager.Drop(); #endregion }
public async Task Single_nulls() { await DelayedTestDataBuilder.SendNullData(table); var consumer = new DelayedQueueManager(table, SqlConnection); await using var result = await consumer.Consume(); await Verify(result !.ToVerifyTarget()); }
public static async Task <IOrderedEnumerable <IncomingDelayedVerifyTarget> > ReadDelayedData(string table, SqlConnection connection) { var reader = new DelayedQueueManager(table, connection); var messages = new ConcurrentBag <IncomingDelayedVerifyTarget>(); await reader.Read(size : 10, startRowVersion : 1, action : message => { messages.Add(message.ToVerifyTarget()); }); return(messages.OrderBy(x => x.Due)); }
public async Task Run() { await using var connection = Connection.OpenConnectionFromNewClient(); var manager = new DelayedQueueManager("DelayedQueueCreationTests", connection); await manager.Drop(); await manager.Create(); var settings = new VerifySettings(); settings.SchemaSettings(includeItem: s => s == "DelayedQueueCreationTests"); await Verify(connection, settings); }
static async Task CreateTables() { await using var dbConnection = await ConnectionBuilder(); var main = new QueueManager("SampleEndpoint", dbConnection); await main.Create(); var delayed = new DelayedQueueManager("SampleEndpoint.Delayed", dbConnection); await delayed.Create(); var subscription = new SubscriptionManager("SubscriptionRouting", dbConnection); await subscription.Create(); }
public async Task Batch() { await DelayedTestDataBuilder.SendMultipleData(table); var consumer = new DelayedQueueManager(table, SqlConnection); var messages = new ConcurrentBag <IncomingDelayedVerifyTarget>(); var result = await consumer.Consume(size : 3, action : message => { messages.Add(message.ToVerifyTarget()); }); Assert.Equal(3, result.Count); Assert.Equal(3, result.LastRowVersion); await Verify(messages.OrderBy(x => x.Due)); }
async Task Send() { string headers = null !; byte[] body = null !; #region SendDelayed var manager = new DelayedQueueManager("endpointTable.Delayed", sqlConnection); var message = new OutgoingDelayedMessage( due: DateTime.UtcNow.AddDays(1), headers: headers, bodyBytes: body); await manager.Send(message); #endregion }
async Task Read() { #region ReadDelayed var queueManager = new DelayedQueueManager("endpointTable", sqlConnection); var message = await queueManager.Read(rowVersion : 10) .ConfigureAwait(false); Console.WriteLine(message.Headers); using (var reader = new StreamReader(message.Body)) { var bodyText = await reader.ReadToEndAsync() .ConfigureAwait(false); Console.WriteLine(bodyText); } #endregion }
async Task Read() { #region ReadDelayed var manager = new DelayedQueueManager("endpointTable", sqlConnection); var message = await manager.Read(rowVersion : 10); if (message != null) { Console.WriteLine(message.Headers); if (message.Body != null) { using var reader = new StreamReader(message.Body); var bodyText = await reader.ReadToEndAsync(); Console.WriteLine(bodyText); } } #endregion }