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.
 
 
 

51 regels
2.3 KiB

  1. using System.Data;
  2. using System.Threading.Tasks;
  3. namespace DotNetCore.CAP
  4. {
  5. /// <summary>
  6. /// A publish service for publish a message to CAP.
  7. /// </summary>
  8. public interface ICapPublisher
  9. {
  10. /// <summary>
  11. /// Publish a string message to specified topic.
  12. /// <para>
  13. /// If you are using the EntityFramework, you need to configure the DbContextType first.
  14. /// otherwise you need to use overloaded method with IDbConnection and IDbTransaction.
  15. /// </para>
  16. /// </summary>
  17. /// <param name="name">the topic name or exchange router key.</param>
  18. /// <param name="content">message body content.</param>
  19. Task PublishAsync(string name, string content);
  20. /// <summary>
  21. /// Publis a object message to specified topic.
  22. /// <para>
  23. /// If you are using the EntityFramework, you need to configure the DbContextType first.
  24. /// otherwise you need to use overloaded method with IDbConnection and IDbTransaction.
  25. /// </para>
  26. /// </summary>
  27. /// <typeparam name="T">The type of conetent object.</typeparam>
  28. /// <param name="name">the topic name or exchange router key.</param>
  29. /// <param name="contentObj">object instance that will be serialized of json.</param>
  30. Task PublishAsync<T>(string name, T contentObj);
  31. /// <summary>
  32. /// Publish a string message to specified topic with transacton.
  33. /// </summary>
  34. /// <param name="name">the topic name or exchange router key.</param>
  35. /// <param name="content">message body content.</param>
  36. /// <param name="dbConnection">the dbConnection of <see cref="IDbConnection"/></param>
  37. Task PublishAsync(string name, string content, IDbConnection dbConnection);
  38. /// <summary>
  39. /// Publish a string message to specified topic with transacton.
  40. /// </summary>
  41. /// <param name="name">the topic name or exchange router key.</param>
  42. /// <param name="content">message body content.</param>
  43. /// <param name="dbConnection">the connection of <see cref="IDbConnection"/></param>
  44. /// <param name="dbTransaction">the transaction of <see cref="IDbTransaction"/></param>
  45. Task PublishAsync(string name, string content, IDbConnection dbConnection, IDbTransaction dbTransaction);
  46. }
  47. }