static void Main(string[] args) { var services = new ServiceCollection(); ConfigureServices(services); IQueueReader reader = null; IQueueWriter writer = null; using (ServiceProvider serviceProvider = services.BuildServiceProvider()) { writer = serviceProvider.GetService <IQueueWriter>(); reader = serviceProvider.GetService <IQueueReader>(); } var putMsg = new QueueMessage() { CorrelationId = Guid.NewGuid().ToString(), Data = "This is a message", QueueName = "DEV.QUEUE.1" }; writer.Enqueue(putMsg); var getMsg = reader.Dequque(); Console.WriteLine(getMsg.Data); }
public ActionResult Create(TenantRentalOffer offer) { try { //TODO add and check validation _audit.Audit(offer); _queueWriter.Enqueue(offer); TempData["info"] = "You offer has been submitted"; return(RedirectToAction("Index", "Favourites")); } catch { return(View()); } }
public Task <IResult <Unit> > Handle(StartMatch request, CancellationToken cancellationToken) { _provider.ExecuteCommand(db => { var match = db.GetCollection <Append>().FindById(request.MatchId); if (match == null) { throw new InvalidOperationException($"Append id {request.MatchId} does not exist."); } _queueWriter.Enqueue(new PerformAppend { MatchId = request.MatchId }, cancellationToken); match.Status = AppendStatus.Queued; db.GetCollection <Append>().Update(match); }); return(Task.FromResult <IResult <Unit> >(new SuccessResult())); }