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
830 B

  1. using System;
  2. using System.Threading.Tasks;
  3. using DotNetCore.CAP;
  4. using Microsoft.AspNetCore.Mvc;
  5. namespace Sample.AzureServiceBus.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.azure.mysql2", DateTime.Now);
  19. return Ok();
  20. }
  21. [CapSubscribe("sample.azure.mysql2")]
  22. public void Test2T2(DateTime value)
  23. {
  24. Console.WriteLine("Subscriber output message: " + value);
  25. }
  26. }
  27. }