diff --git a/docs/content/user-guide/en/cap/configuration.md b/docs/content/user-guide/en/cap/configuration.md index 9bdf0cd..8079f7e 100644 --- a/docs/content/user-guide/en/cap/configuration.md +++ b/docs/content/user-guide/en/cap/configuration.md @@ -71,6 +71,12 @@ In the process of message consumption failed, the CAP will retry to execute. Thi By default, retry will start after **4 minutes** of failure to send or consume, in order to avoid possible problems caused by setting message state delays. Failures in the process of sending and consuming messages will be retried 3 times immediately, and will be retried polling after 3 times, at which point the FailedRetryInterval configuration will take effect. +#### ConsumerThreadCount + +> Default : 1 + +Number of consumer threads, when this value is greater than 1, the order of message execution cannot be guaranteed + #### FailedRetryCount > Default: 50 diff --git a/docs/content/user-guide/en/cap/serialization.md b/docs/content/user-guide/en/cap/serialization.md index 8356a59..7cf5000 100644 --- a/docs/content/user-guide/en/cap/serialization.md +++ b/docs/content/user-guide/en/cap/serialization.md @@ -1,40 +1,36 @@ # Serialization -CAP does not currently support serialization for transport messages, and CAP uses json to serialize message objects before sending them to the transport. +We provide the `ISerializer` interface to support serialization of messages. By default, we use json to serialize messages and store them in the database. -## Content Serialization +## Custom Serialization -The CAP supports serializing the Message's Content field, which you can do by customizing the `IContentSerializer` interface. - -Currently, since the message object needs to be stored in the database, only the serialization and reverse ordering of `string` are supported. - -```csharp - -class MyContentSerializer : IContentSerializer +```C# +public class YourSerializer: ISerializer { - public T DeSerialize(string messageObjStr) + Task SerializeAsync(Message message) { - } - public object DeSerialize(string content, Type type) - { } - - public string Serialize(T messageObj) + + Task DeserializeAsync(TransportMessage transportMessage, Type valueType) { + } } ``` -Configure the custom `MyContentSerializer` to the service. +Then register your implementation in the container: -```csharp +``` + +services.AddSingleton(); -services.AddCap(x =>{ }).AddContentSerializer(); +// --- +services.AddCap ``` -## Message Adapter +## Message Adapter (removed in v3.0) In heterogeneous systems, sometimes you need to communicate with other systems, but other systems use message objects that may be different from CAP's [**Wrapper Object**](../persistent/general.md#_7). This time maybe you need to customize the message wapper. diff --git a/docs/content/user-guide/zh/cap/configuration.md b/docs/content/user-guide/zh/cap/configuration.md index b313cc0..db87243 100644 --- a/docs/content/user-guide/zh/cap/configuration.md +++ b/docs/content/user-guide/zh/cap/configuration.md @@ -74,7 +74,7 @@ services.AddCap(config => 默认值:1 -消费者线程并行处理消息的线程数。 +消费者线程并行处理消息的线程数,当这个值大于1时,将不能保证消息执行的顺序。 #### FailedRetryCount