Browse Source

update docs

master
Savorboard 4 years ago
parent
commit
c3ec6e84c9
3 changed files with 22 additions and 20 deletions
  1. +6
    -0
      docs/content/user-guide/en/cap/configuration.md
  2. +15
    -19
      docs/content/user-guide/en/cap/serialization.md
  3. +1
    -1
      docs/content/user-guide/zh/cap/configuration.md

+ 6
- 0
docs/content/user-guide/en/cap/configuration.md View File

@@ -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. 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. 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 #### FailedRetryCount


> Default: 50 > Default: 50


+ 15
- 19
docs/content/user-guide/en/cap/serialization.md View File

@@ -1,40 +1,36 @@
# Serialization # 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<T>(string messageObjStr)
Task<TransportMessage> SerializeAsync(Message message)
{ {
}


public object DeSerialize(string content, Type type)
{
} }
public string Serialize<T>(T messageObj)
Task<Message> DeserializeAsync(TransportMessage transportMessage, Type valueType)
{ {

} }
} }
``` ```


Configure the custom `MyContentSerializer` to the service.
Then register your implementation in the container:


```csharp
```

services.AddSingleton<ISerializer, YourSerializer>();


services.AddCap(x =>{ }).AddContentSerializer<MyContentSerializer>();
// ---
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. 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.




+ 1
- 1
docs/content/user-guide/zh/cap/configuration.md View File

@@ -74,7 +74,7 @@ services.AddCap(config =>


默认值:1 默认值:1


消费者线程并行处理消息的线程数。
消费者线程并行处理消息的线程数,当这个值大于1时,将不能保证消息执行的顺序


#### FailedRetryCount #### FailedRetryCount




Loading…
Cancel
Save