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.

implementation.md 5.1 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
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # IMPLEMENTATION
  2. Users can get a ICapPublisher interface from the ASP.NET Core DI container to publish a message .It is initialized by configurations in the `ConfigureServices` and `configure` method in the Startup.cs file,just like the way to initialize a `MiddleWare` in ASP.NET Core.
  3. ## Message Table
  4. After initialized, CAP will create two tables in the client side,they are `Cap.Published` and `Cap.Received`. Please noted that different databases may deal letter case differently,if you do not explicitly specify the Schema or the TableName Prefix before project startup,the default names are the ones mentioned above.
  5. **Cap.Published**:Used to store messages(Published by the `ICapPublisher` service) that CAP published to the MQ(Message Queue)Client side
  6. **Cap.Received**:Used to Store messages(subscribed by the `CapSubscribe[]`) subscribed by the MQ(message Queue) client side that CAP received.
  7. Both `Published` and `Received` tables have a `StatusName` field,which is used to mark the status of the current message.Until now it has `Scheduled`,`Successed` and `Failed` statuses.
  8. In the process of dealing with messages,CAP will change the status from `Scheduled` to `Successed`(or `Failed` ).if the final status is `Successed`,it means that the message is sent to MQ successfully,and `Failed` means the message is failed to sent to MQ.
  9. Version later than 2.2, CAP will retry after 4 minutes if the status is `Scheduled` or `Failed`,the retry interval is default to 60 seconds.You can change it by modify `FailedRetryInterval` in `CapOptions`.
  10. ## Message format
  11. CAP use JSON to transfer message,the following is CAP's messaging object model:
  12. NAME | DESCRIPTION | TYPE
  13. :---|:---|:---
  14. Id | Message Id | int
  15. Version | Message Version | string
  16. Name | Name | string
  17. Content | Content | string
  18. Group | Group a message belongs to | string
  19. Added |add time | DateTime
  20. ExpiresAt | expire time | DateTime
  21. Retries | retry times | int
  22. StatusName | Status Name | string
  23. >for `Cap.Received`,there is an extra `Group` filed to mark which group the mesage belongs to.
  24. >for the `Content` property CAP will use a Messsage object to wrap all the contents.The following shows details of the Message Object:
  25. NAME | DESCRIPTION | TYPE
  26. :---|:---|:---
  27. Id | Generated by CAP | string
  28. Timestamp | message create time | string
  29. Content | content | string
  30. CallbackName | the subscriber which is used to call back | string
  31. CAP use the same algorithms as MongoDB ObjectId's distributed Id generation algorithms.
  32. ## EventBus
  33. EventBus adopt the publish-subscribe messaging style to communicate with different components,and there is no need to register it in component explicitly.
  34. ![](http://images2017.cnblogs.com/blog/250417/201708/250417-20170804153901240-1774287236.png)
  35. the diagram in the above link shows Eventbus's event flowchart,about EventBus,users can refer to other meterials to learn about it.
  36. We say that CAP implement all the features in Eventbus,EventBus has two features:publish and subscribe,In CAP we implement them in an elegant way.Besides,CAP also has two very robust feature,they are message persistence and messaging reliability under any circumstances,But EventBus don't have such features.
  37. ![](https://camo.githubusercontent.com/452505edb71d41f2c1bd18907275b76291621e46/687474703a2f2f696d61676573323031352e636e626c6f67732e636f6d2f626c6f672f3235303431372f3230313730372f3235303431372d32303137303730353137353832373132382d313230333239313436392e706e67)
  38. In CAP,send a message can be regarded as an "Event",When CAP is used in an ASP.NET Core applicaiton,the application has the ablity to publish as well as receive messages.
  39. ## Retry
  40. Retry plays a very important role in CAP's infrastructure,CAP will retry for Failed messages.CAP has the following retry strategies:
  41. **1、 Retry on sending**
  42. in the process of sending a message,when the Broker crashed or connection failed or exceptions are thrown,CAP will retry,it will retry 3 times for the first time,if still failed,then it will retry every 1 minute after 4 minutes,the retry the retry count +1,when the retry count come to 50,CAP will not retry any more.
  43. >You can modify `FailedRetryCount` in `CapOptions` to change the default retry count.
  44. As metioned above,when the retry count comes to a certain number,CAP will not retry anymore,this time,you can find out the fail reason in the Dashboard and they deal with it manually.
  45. **2、 Retry on Consuming**
  46. When consumer received messages,specified method in the consumer will be executed,if exceptions are thrown during this course,CAP will retry,the retry strategy is the same as above `Retry on sending`.
  47. ## Data clean out
  48. table to store messages in database has an `ExpiresAt` field to mark the expiration time of the message. CAP will set `ExpiresAt` value as **1 hour** for `Successed` messages and **15days** for `Failed` messages.
  49. To avoid performance slow down caused by a large amount of data,CAP will delete expired data every hour by default,the deletion rule is that `ExpiresAt` field's value isn't null and samller than current time.That is, `Failed` messages(it has been retried 50 times by default),if you do not deal with it manually,will also be deleted after 15 days as well,you have to pay attention to it.