@rocketmq/core 0.1.1 → 0.1.2
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 +21 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -44,6 +44,27 @@ async function main() {
|
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
### Classic API Style
|
|
48
|
+
|
|
49
|
+
If you prefer the classic AMQP interface over the `QueueHandle` abstraction, you can use `assertQueue` directly while still benefiting from broker-side schema validation and client-side type inference:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
async function classicApiExample() {
|
|
53
|
+
const mq = await connect();
|
|
54
|
+
|
|
55
|
+
// Asserts the queue and registers the schema with the broker
|
|
56
|
+
await mq.assertQueue('orders', Order);
|
|
57
|
+
|
|
58
|
+
// Type-safe consumption
|
|
59
|
+
await mq.consume('orders', (order) => {
|
|
60
|
+
console.log(`Received order: ${order.id} for ${order.quantity} items`);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Type-safe publishing
|
|
64
|
+
mq.sendToQueue('orders', { id: '123', quantity: 5 });
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
47
68
|
## License
|
|
48
69
|
|
|
49
70
|
Apache 2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocketmq/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@rocketmq/amqp": "0.1.1",
|
|
13
|
-
"@rocketmq/serializer": "0.1.1",
|
|
14
12
|
"@rocketmq/schema": "0.1.1",
|
|
15
|
-
"@rocketmq/
|
|
13
|
+
"@rocketmq/serializer": "0.1.1",
|
|
14
|
+
"@rocketmq/protobuf": "0.1.1",
|
|
15
|
+
"@rocketmq/amqp": "0.1.1"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsup",
|