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.

getting-started.md 6.3 KiB

add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
add docs to master (#284) * update version to 2.4.0 * Add version options to config file. * update resource * add message version support for dashboard * add message version support for dashboard * Support using version to isolate messages. #220 * update mongo unit tests * update unit tests * update unit tests * Set default versions for consumer groups * solve the problem of issue#181 (#237) * Issue#235 (#238) * solve the problem of issue#181 * solve the problem of issue#235 * refactor * Fix the message persistence bug. #240 * using new CamelCaseNamingStrategy * update packages to .net core 2.2 * update test framework to netcoreapp2.2 * Update .travis.yml * update TargetFramework * Exclude build samples project * update version to 2.4.1 * add samples project to sln for build * update version to 2.4.2 * Fixed PostgreSql version isolation feature bug. (#256) * Fixed spelling errors * modify cap publish Message to rabbitmq slow (#261) * Startup the CAP with the BackgroundService. #265 * update samples * Fixed SQL query bug. #266 * update travis ci config * update travis ci config * adjust dashboard table column width * adjust the consumer execution time to milliseconds * update ignore * add mkdocs.yml * update version to 2.4.3 * add about.md docs * add index.md docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * add docs * Fix resource files * add docs * add docs * add docs * Create readme.md * add markdown extensions supports * update about.md * add CNAME fiel * add img * update docs * Update README.zh-cn.md
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. # Getting Stared
  2. ## Usage
  3. #### 1. Distributed transaction alternative solution in micro-service base on eventually consistency
  4. A distributed transaction is a very complex process with a lot of moving parts that can fail. Also, if these parts run on different machines or even in different data centers, the process of committing a transaction could become very long and unreliable.
  5. This could seriously affect the user experience and overall system bandwidth. So one of the best ways to solve the problem of distributed transactions is to avoid them completely.
  6. Usually, a microservice is designed in such way as to be independent and useful on its own. It should be able to solve some atomic business task.
  7. If we could split our system in such microservices, there’s a good chance we wouldn’t need to implement transactions between them at all.
  8. By far, one of the most feasible models of handling consistency across microservices is eventual consistency. This model doesn’t enforce distributed ACID transactions across microservices. Instead, it proposes to use some mechanisms of ensuring that the system would be eventually consistent at some point in the future.
  9. CAP ia an alternative solution without transactions, it comply the eventually consistency and implement base on message queue.
  10. #### 2. EventBus with Outbox pattern
  11. CAP is an event bus that implements the Outbox pattern, Outbox is an infrastructure feature which simulates the reliability of distributed transactions without requiring use of the Distributed Transaction Coordinator(DTC).
  12. The outbox feature can be used instead of the DTC to mimic the same level of consistency without using distributed transactions.
  13. !!! Tip "CAP implements the Outbox Pattern described in the [eShop ebook](https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/subscribe-events#designing-atomicity-and-resiliency-when-publishing-to-the-event-bus)"
  14. <img src="https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/media/image24.png">
  15. > Atomicity when publishing events to the event bus with a worker microservice
  16. ## Quick Start
  17. ### NuGet Package
  18. Use the following command to reference the CAP NuGet package:
  19. ```
  20. PM> Install-Package DotNetCore.CAP
  21. ```
  22. According to the different types of message queues used, different extension packages are introduced:
  23. ``` text
  24. PM> Install-Package DotNetCore.CAP.RabbitMQ
  25. PM> Install-Package DotNetCore.CAP.Kafka
  26. PM> Install-Package DotNetCore.CAP.AzureServiceBus
  27. ```
  28. According to the different types of databases used, different extension packages are introduced:
  29. ``` text
  30. PM> Install-Package DotNetCore.CAP.SqlServer
  31. PM> Install-Package DotNetCore.CAP.MySql
  32. PM> Install-Package DotNetCore.CAP.PostgreSql
  33. PM> Install-Package DotNetCore.CAP.MongoDB
  34. ```
  35. ### Startup Configuration
  36. In an ASP.NET Core program, you can configure the services used by the CAP in the `Startup.cs` file `ConfigureServices()`:
  37. ```c#
  38. public void ConfigureServices(IServiceCollection services)
  39. {
  40. //......
  41. services.AddDbContext<AppDbContext>(); //Options, If you are using EF as the ORM
  42. services.AddSingleton<IMongoClient>(new MongoClient("")); //Options, If you are using MongoDB
  43. services.AddCap(x =>
  44. {
  45. // If you are using EF, you need to add the configuration:
  46. //Options, Notice: You don't need to config x.UseSqlServer(""") again! CAP can autodiscovery.
  47. x.UseEntityFramework<AppDbContext>();
  48. // If you are using Ado.Net, you need to add the configuration:
  49. x.UseSqlServer("Your ConnectionStrings");
  50. x.UseMySql("Your ConnectionStrings");
  51. x.UsePostgreSql("Your ConnectionStrings");
  52. // If you are using MongoDB, you need to add the configuration:
  53. x.UseMongoDB("Your ConnectionStrings"); //MongoDB 4.0+ cluster
  54. // If you are using RabbitMQ, you need to add the configuration:
  55. x.UseRabbitMQ("localhost");
  56. // If you are using Kafka, you need to add the configuration:
  57. x.UseKafka("localhost");
  58. });
  59. }
  60. ```
  61. ### Usage
  62. #### Publish
  63. Inject `ICapPublisher` in your Controller, then use the `ICapPublisher` to send message
  64. ```c#
  65. public class PublishController : Controller
  66. {
  67. private readonly ICapPublisher _capBus;
  68. public PublishController(ICapPublisher capPublisher)
  69. {
  70. _capBus = capPublisher;
  71. }
  72. [Route("~/adonet/transaction")]
  73. public IActionResult AdonetWithTransaction()
  74. {
  75. using (var connection = new MySqlConnection(ConnectionString))
  76. {
  77. using (var transaction = connection.BeginTransaction(_capBus, autoCommit: true))
  78. {
  79. //your business logic code
  80. _capBus.Publish("xxx.services.show.time", DateTime.Now);
  81. }
  82. }
  83. return Ok();
  84. }
  85. [Route("~/ef/transaction")]
  86. public IActionResult EntityFrameworkWithTransaction([FromServices]AppDbContext dbContext)
  87. {
  88. using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: true))
  89. {
  90. //your business logic code
  91. _capBus.Publish("xxx.services.show.time", DateTime.Now);
  92. }
  93. return Ok();
  94. }
  95. }
  96. ```
  97. #### Subscribe
  98. **In Controller Action**
  99. Add the Attribute `[CapSubscribe()]` on Action to subscribe message:
  100. ```c#
  101. public class PublishController : Controller
  102. {
  103. [CapSubscribe("xxx.services.show.time")]
  104. public void CheckReceivedMessage(DateTime datetime)
  105. {
  106. Console.WriteLine(datetime);
  107. }
  108. }
  109. ```
  110. **In Business Logic Service**
  111. If your subscribe method is not in the Controller, the service class you need to Inheritance `ICapSubscribe`:
  112. ```c#
  113. namespace BusinessCode.Service
  114. {
  115. public interface ISubscriberService
  116. {
  117. public void CheckReceivedMessage(DateTime datetime);
  118. }
  119. public class SubscriberService: ISubscriberService, ICapSubscribe
  120. {
  121. [CapSubscribe("xxx.services.show.time")]
  122. public void CheckReceivedMessage(DateTime datetime)
  123. {
  124. }
  125. }
  126. }
  127. ```
  128. Then inject your `ISubscriberService` class in `Startup.cs`
  129. ```c#
  130. public void ConfigureServices(IServiceCollection services)
  131. {
  132. //Note: The injection of services needs before of `services.AddCap()`
  133. services.AddTransient<ISubscriberService,SubscriberService>();
  134. services.AddCap(x=>
  135. {
  136. //...
  137. });
  138. }
  139. ```