hexok 2.2.4 → 2.2.5
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/package.json
CHANGED
|
@@ -25,6 +25,8 @@ export class Blog extends Contract('blog', {
|
|
|
25
25
|
|
|
26
26
|
`Message(type, version, schema)` is an `Event` with a `version`. `Contract(name, topics)` maps each key to its messages. The queue topic is `<name>.<key>`, here `blog.posts`.
|
|
27
27
|
|
|
28
|
+
Contract schemas describe JSON. `Date`, `bigint`, `Map`, and `Set` do not survive the queue. Use strings and numbers, such as an ISO string for a time. `publish` validates the JSON form of the payload and sends that form, so keys the schema would strip are still sent. A payload that is not JSON or fails its schema throws `VALIDATION` before anything is sent.
|
|
29
|
+
|
|
28
30
|
## Producer
|
|
29
31
|
|
|
30
32
|
The use case depends on a port. The adapter wraps `IntegrationPublisher`.
|
|
@@ -76,8 +78,8 @@ await blog.subscribe({ maxDeliveries: 10, handlers: [new ProjectPost({ posts })]
|
|
|
76
78
|
- An additive change keeps the version. Consumer schemas accept unknown fields.
|
|
77
79
|
- A breaking change is a new `Message` of the same type and the next version, with `downgrade: { to, map }` to the previous one. Add it to the same topic. One `publish` of the newest version sends every version in the topic.
|
|
78
80
|
- `publish` accepts only the newest version.
|
|
79
|
-
- Retire an old version after every consumer moves. Remove it from the topic and remove the downgrade that targets it.
|
|
81
|
+
- Retire an old version after every consumer moves. Remove it from the topic and remove the downgrade that targets it. Until a consumer moves, its handler for the retired version receives nothing and logs nothing, and the new contract makes its `subscribe` throw.
|
|
80
82
|
|
|
81
83
|
## What the application owns
|
|
82
84
|
|
|
83
|
-
Retention, backfill for a new consumer, order between redeliveries, the outbox, and topic permissions in the broker.
|
|
85
|
+
Retention, backfill for a new consumer, order between redeliveries, the outbox, and topic permissions in the broker. Every handler reads every entry on its topic, so keep topics narrow, such as one per aggregate.
|