You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
841 B

  1. using System;
  2. using System.Threading.Tasks;
  3. using DotNetCore.CAP;
  4. using Microsoft.AspNetCore.Mvc;
  5. namespace Sample.AmazonSQS.InMemory.Controllers
  6. {
  7. [Route("api/[controller]")]
  8. public class ValuesController : Controller, ICapSubscribe
  9. {
  10. private readonly ICapPublisher _capBus;
  11. public ValuesController(ICapPublisher producer)
  12. {
  13. _capBus = producer;
  14. }
  15. [Route("~/without/transaction")]
  16. public async Task<IActionResult> WithoutTransaction()
  17. {
  18. await _capBus.PublishAsync("sample.aws.in-memory", DateTime.Now);
  19. return Ok();
  20. }
  21. [CapSubscribe("sample.aws.in-memory")]
  22. public void SubscribeInMemoryTopic(DateTime value)
  23. {
  24. Console.WriteLine("Subscriber output message: " + value);
  25. }
  26. }
  27. }