@rocketmq/serializer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @rocketmq/serializer
|
|
2
|
+
|
|
3
|
+
Serialization adapters for RocketMQ payloads.
|
|
4
|
+
|
|
5
|
+
This package provides the `Serializer` interface and a default `JsonSerializer` implementation used by the SDK to convert TypeScript objects to and from `Buffer` payloads for AMQP transmission.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @rocketmq/serializer
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
The `JsonSerializer` is used by default in `@rocketmq/core`. You can implement the `Serializer` interface to create custom formats (e.g., Avro, MessagePack).
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { JsonSerializer } from '@rocketmq/serializer';
|
|
19
|
+
|
|
20
|
+
const serializer = new JsonSerializer();
|
|
21
|
+
|
|
22
|
+
const buf = serializer.serialize({ hello: 'world' });
|
|
23
|
+
const obj = serializer.deserialize(buf);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
Apache 2.0
|