@kronos-ts/axon-server 0.2.11 → 0.3.0
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/dist/axon-server-event-store.d.ts +1 -1
- package/dist/axon-server-event-store.d.ts.map +1 -1
- package/dist/axon-server-event-store.js +3 -3
- package/dist/axon-server-event-store.js.map +1 -1
- package/dist/axon-server-snapshot-store.d.ts +1 -1
- package/dist/axon-server-snapshot-store.d.ts.map +1 -1
- package/dist/axon-server-snapshot-store.js +1 -1
- package/dist/axon-server-snapshot-store.js.map +1 -1
- package/dist/axon-server.d.ts +169 -43
- package/dist/axon-server.d.ts.map +1 -1
- package/dist/axon-server.js +191 -323
- package/dist/axon-server.js.map +1 -1
- package/dist/connection-manager.d.ts +2 -2
- package/dist/connection-manager.d.ts.map +1 -1
- package/dist/connection-manager.js +1 -1
- package/dist/connection-manager.js.map +1 -1
- package/dist/control-plane.d.ts +108 -0
- package/dist/control-plane.d.ts.map +1 -0
- package/dist/control-plane.js +96 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/flow-controlled-sender.d.ts +1 -1
- package/dist/flow-controlled-sender.d.ts.map +1 -1
- package/dist/flow-controlled-sender.js +1 -1
- package/dist/flow-controlled-sender.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/message-size.d.ts +1 -1
- package/dist/message-size.d.ts.map +1 -1
- package/dist/message-size.js +1 -1
- package/dist/message-size.js.map +1 -1
- package/dist/outbound-stream.d.ts +1 -1
- package/dist/outbound-stream.d.ts.map +1 -1
- package/dist/outbound-stream.js +1 -1
- package/dist/outbound-stream.js.map +1 -1
- package/dist/platform-service.d.ts +34 -3
- package/dist/platform-service.d.ts.map +1 -1
- package/dist/platform-service.js +113 -42
- package/dist/platform-service.js.map +1 -1
- package/dist/shutdown-latch.d.ts +1 -1
- package/dist/shutdown-latch.d.ts.map +1 -1
- package/dist/shutdown-latch.js +1 -1
- package/dist/shutdown-latch.js.map +1 -1
- package/package.json +5 -5
- package/src/axon-server-event-store.ts +3 -3
- package/src/axon-server-snapshot-store.ts +1 -1
- package/src/axon-server.ts +283 -367
- package/src/connection-manager.ts +2 -2
- package/src/control-plane.ts +195 -0
- package/src/flow-controlled-sender.ts +1 -1
- package/src/index.ts +19 -8
- package/src/message-size.ts +1 -1
- package/src/outbound-stream.ts +1 -1
- package/src/platform-service.ts +152 -48
- package/src/shutdown-latch.ts +1 -1
|
@@ -12,5 +12,5 @@ import type { AxonServerConnection } from "./connection.js";
|
|
|
12
12
|
* a single gRPC Stream RPC call that stays open indefinitely, aligned with
|
|
13
13
|
* Java's infinite {@code ResultStream}.
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function axonServerEventStore(connection: AxonServerConnection, serializer: Serializer): EventStore;
|
|
16
16
|
//# sourceMappingURL=axon-server-event-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server-event-store.d.ts","sourceRoot":"","sources":["../src/axon-server-event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAA;AAS1B,OAAO,KAAK,EACV,UAAU,EAMX,MAAM,0BAA0B,CAAA;AAIjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAmH3D;;;;;;;;;;GAUG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"axon-server-event-store.d.ts","sourceRoot":"","sources":["../src/axon-server-event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAA;AAS1B,OAAO,KAAK,EACV,UAAU,EAMX,MAAM,0BAA0B,CAAA;AAIjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAmH3D;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,CA+MzG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qualifiedNameToString, qualifiedNameFromString, } from "@kronos-ts/common";
|
|
2
|
-
import {
|
|
2
|
+
import { messageStream } from "@kronos-ts/messaging";
|
|
3
3
|
import { globalSequenceToken, FIRST_TOKEN } from "@kronos-ts/messaging";
|
|
4
4
|
import { markerAt, noMarker } from "@kronos-ts/eventsourcing";
|
|
5
5
|
import { Metadata } from "nice-grpc";
|
|
@@ -103,7 +103,7 @@ function createEventConverters(serializer) {
|
|
|
103
103
|
* a single gRPC Stream RPC call that stays open indefinitely, aligned with
|
|
104
104
|
* Java's infinite {@code ResultStream}.
|
|
105
105
|
*/
|
|
106
|
-
export function
|
|
106
|
+
export function axonServerEventStore(connection, serializer) {
|
|
107
107
|
const { eventToProto, eventFromProto } = createEventConverters(serializer);
|
|
108
108
|
function createAxonMetadata() {
|
|
109
109
|
const axonMetadata = new Metadata();
|
|
@@ -230,7 +230,7 @@ export function createAxonServerEventStore(connection, serializer) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
startReading();
|
|
233
|
-
return
|
|
233
|
+
return messageStream({
|
|
234
234
|
next() {
|
|
235
235
|
return buffer.shift();
|
|
236
236
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server-event-store.js","sourceRoot":"","sources":["../src/axon-server-event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GAGxB,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"axon-server-event-store.js","sourceRoot":"","sources":["../src/axon-server-event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GAGxB,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;A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,UAAU;YACd,OAAO,WAAW,CAAA;QACpB,CAAC;QAED,KAAK,CAAC,WAAW;YACf,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAA;YAC5F,OAAO,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAC/C,CAAC;QAED,sEAAsE;QACtE,0BAA0B;QAC1B,KAAK,CAAC,OAAO,CAAC,MAAmC;YAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC3B,CAAC;QAED,SAAS,CAAC,OAA+D;YACvE,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,OAAO,GAAG,EAAE;gBACV,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC7B,CAAC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -8,5 +8,5 @@ import type { AxonServerConnection } from "./connection.js";
|
|
|
8
8
|
* state snapshots. Payload serialization uses the configured
|
|
9
9
|
* Serializer (defaults to JSON).
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function axonServerSnapshotStore(connection: AxonServerConnection, serializer: Serializer): SnapshotStore;
|
|
12
12
|
//# sourceMappingURL=axon-server-snapshot-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server-snapshot-store.d.ts","sourceRoot":"","sources":["../src/axon-server-snapshot-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,0BAA0B,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAiD3D;;;;;;GAMG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"axon-server-snapshot-store.d.ts","sourceRoot":"","sources":["../src/axon-server-snapshot-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,0BAA0B,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAiD3D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,oBAAoB,EAChC,UAAU,EAAE,UAAU,GACrB,aAAa,CAwDf"}
|
|
@@ -42,7 +42,7 @@ function encodeKey(stateName, id) {
|
|
|
42
42
|
* state snapshots. Payload serialization uses the configured
|
|
43
43
|
* Serializer (defaults to JSON).
|
|
44
44
|
*/
|
|
45
|
-
export function
|
|
45
|
+
export function axonServerSnapshotStore(connection, serializer) {
|
|
46
46
|
const { snapshotToProto, snapshotFromProto } = createSnapshotConverters(serializer);
|
|
47
47
|
function createAxonMetadata() {
|
|
48
48
|
const axonMetadata = new Metadata();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server-snapshot-store.js","sourceRoot":"","sources":["../src/axon-server-snapshot-store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,8EAA8E;AAC9E,mDAAmD;AACnD,8EAA8E;AAE9E,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,SAAS,wBAAwB,CAAC,UAAsB;IACtD,OAAO;QACL,eAAe,CAAC,QAAkB;YAChC,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;YACzE,OAAO;gBACL,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,UAAU,CAAC,IAAI;gBACxB,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;gBACrC,QAAQ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ACb,oEAAoE;gBACpE,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;oBAC9C,OAAO,SAAS,CAAA;gBAClB,CAAC;gBACD,MAAM,GAAG,CAAA;YACX,CAAC;QACH,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,SAAiB,EAAE,EAAW;YAClD,MAAM,UAAU,CAAC,aAAa,CAAC,MAAM,CACnC;gBACE,GAAG,EAAE,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC;gBAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;aAC5C,EACD,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,CACnC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/axon-server.d.ts
CHANGED
|
@@ -1,42 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
2
|
+
* Axon Server backend for kronos.
|
|
3
|
+
*
|
|
4
|
+
* `axonServer(config)` is an async factory: it connects eagerly, hands back
|
|
5
|
+
* the four components it provides (eventStore, snapshotStore, commandBus,
|
|
6
|
+
* queryBus), and gives you a `start`/`close` pair. There is no lifecycle
|
|
7
|
+
* framework — the ordering that used to be encoded as `onStart("connect")` /
|
|
8
|
+
* `onStart("processors")` / `onStop("connect")` is now three lines you write
|
|
9
|
+
* in your composition root:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const axon = await axonServer({
|
|
13
|
+
* componentName: "university-service",
|
|
14
|
+
* serializer,
|
|
15
|
+
* unitOfWorkFactory,
|
|
16
|
+
* })
|
|
17
|
+
* const app = kronos({
|
|
18
|
+
* components: { ...inMemoryComponents({ serializer, unitOfWorkFactory }), ...axon.components },
|
|
19
|
+
* modules,
|
|
20
|
+
* })
|
|
21
|
+
* await axon.start() // readiness barrier: the server can route to our handlers
|
|
22
|
+
* // …
|
|
23
|
+
* await app.stop(); await axon.close()
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Connecting before the app is built is what removes the lazy proxies and
|
|
27
|
+
* subscribe-buffering wrappers the container version needed: by the time
|
|
28
|
+
* `kronos` subscribes a handler, the gRPC streams are already live.
|
|
29
|
+
*
|
|
30
|
+
* REMOTE ADMINISTRATION IS NOT IN HERE. Processor instructions (pause / start /
|
|
31
|
+
* release / split / merge) and processor status reporting are the platform
|
|
32
|
+
* CONTROL PLANE — they are neither persistence nor transport, and lived here
|
|
33
|
+
* only because they share this gRPC connection. They are now an opt-in second
|
|
34
|
+
* object built on the platform stream this backend exposes:
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* const control = await axonServerControlPlane(axon.platform, app.processors.values())
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* `start()` therefore takes NO arguments and does exactly one thing: the
|
|
41
|
+
* data-path readiness barrier. See `control-plane.ts`.
|
|
42
|
+
*
|
|
43
|
+
* Axon-specific protocol invariants are preserved byte-for-byte:
|
|
23
44
|
*
|
|
24
45
|
* - CLIENT_SUPPORTS_STREAMING capability advertised on every dispatched
|
|
25
46
|
* query via `defaultQueryInstructions(...)`;
|
|
26
47
|
* - AxonIQ-Context + AxonIQ-Access-Token gRPC metadata headers built by
|
|
27
48
|
* `createAxonMetadata(...)` and attached to every outbound stream/RPC;
|
|
28
49
|
* - permits-AFTER-subscriptions stream ordering preserved on the initial
|
|
29
|
-
* handshake AND on reconnect (
|
|
30
|
-
*
|
|
31
|
-
*
|
|
50
|
+
* handshake AND on reconnect (see `ensureStreamStarted` /
|
|
51
|
+
* `reestablishStreamBody`);
|
|
52
|
+
* - shutdown ordering: busLatches → platform.stop → connection.close.
|
|
32
53
|
*/
|
|
33
54
|
import { type Serializer, type ResilienceConfig } from "@kronos-ts/common";
|
|
34
|
-
import type {
|
|
35
|
-
import type { QueryBus, UoWRunner } from "@kronos-ts/messaging";
|
|
55
|
+
import type { CommandBus, QueryBus, UoWRunner } from "@kronos-ts/messaging";
|
|
36
56
|
import type { AxonServerConnectionConfig } from "./connection.js";
|
|
37
57
|
import { type AxonServerConnection } from "./connection.js";
|
|
58
|
+
import { axonServerEventStore } from "./axon-server-event-store.js";
|
|
59
|
+
import { axonServerSnapshotStore } from "./axon-server-snapshot-store.js";
|
|
38
60
|
import { type ShutdownLatch } from "./shutdown-latch.js";
|
|
39
|
-
import { type PlatformServiceOptions } from "./platform-service.js";
|
|
61
|
+
import { type PlatformConnection, type PlatformServiceOptions } from "./platform-service.js";
|
|
40
62
|
/**
|
|
41
63
|
* Flow control configuration for a bus channel.
|
|
42
64
|
*/
|
|
@@ -58,7 +80,7 @@ export interface ProcessingInstructions {
|
|
|
58
80
|
/** Timeout in ms. Axon Server cancels the command/query if not handled in time. */
|
|
59
81
|
timeoutMs?: number;
|
|
60
82
|
}
|
|
61
|
-
export interface
|
|
83
|
+
export interface AxonServerConfig extends AxonServerConnectionConfig {
|
|
62
84
|
/** Flow control for the command bus channel. */
|
|
63
85
|
commandFlowControl?: FlowControlConfig;
|
|
64
86
|
/** Flow control for the query bus channel. */
|
|
@@ -95,26 +117,118 @@ export interface AxonServerExtensionConfig extends AxonServerConnectionConfig {
|
|
|
95
117
|
/** Per-extension resilience config (D-100 / D-101). */
|
|
96
118
|
resilience?: Partial<ResilienceConfig>;
|
|
97
119
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
120
|
+
* How long `start()` waits for Axon Server's routing tables to register the
|
|
121
|
+
* subscribe frames sent on the command/query streams. This is the entire
|
|
122
|
+
* data-path readiness barrier.
|
|
123
|
+
*
|
|
124
|
+
* It is a timed wait rather than an observed signal because nothing on the
|
|
125
|
+
* client can observe it: subscribes travel on the bus streams, and the
|
|
126
|
+
* platform stream — which is where an ack would arrive — is a different
|
|
127
|
+
* stream that Axon Server holds open silently after `register`. Default:
|
|
128
|
+
* 1000, matching the legacy enhancer. Tests against a freshly-booted server
|
|
129
|
+
* can tighten this once subscriptions are observed to land faster.
|
|
104
130
|
*/
|
|
105
131
|
busSubscriptionAckDelayMs?: number;
|
|
106
132
|
}
|
|
133
|
+
/** The components an Axon Server backend provides. Spread into `kronos`. */
|
|
134
|
+
export interface AxonServerComponents {
|
|
135
|
+
eventStore: ReturnType<typeof axonServerEventStore>;
|
|
136
|
+
snapshotStore: ReturnType<typeof axonServerSnapshotStore>;
|
|
137
|
+
commandBus: CommandBus;
|
|
138
|
+
queryBus: QueryBus;
|
|
139
|
+
}
|
|
107
140
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
141
|
+
* A live Axon Server backend: the components it provides plus the two calls
|
|
142
|
+
* that used to be lifecycle stages.
|
|
143
|
+
*/
|
|
144
|
+
/** Everything axonServer() needs: its own config plus the framework values it borrows. */
|
|
145
|
+
export type AxonServerOptions = AxonServerConfig & {
|
|
146
|
+
serializer: Serializer;
|
|
147
|
+
unitOfWorkFactory: UoWRunner;
|
|
148
|
+
};
|
|
149
|
+
export interface AxonServerBackend {
|
|
150
|
+
readonly components: AxonServerComponents;
|
|
151
|
+
/**
|
|
152
|
+
* The platform stream. It is built here because the backend owns the gRPC
|
|
153
|
+
* connection it rides on and the `platformService` tuning that configures it.
|
|
154
|
+
*
|
|
155
|
+
* `start()` below brings it up for the DATA path — heartbeats and reconnect
|
|
156
|
+
* detection — via `platform.armConnectionMonitoring()`. What it deliberately
|
|
157
|
+
* does NOT do is arm processor status reporting or route instructions: that is
|
|
158
|
+
* remote administration, and it stays opt-in behind
|
|
159
|
+
* `axonServerControlPlane(axon.platform, …)`, which registers its handler and
|
|
160
|
+
* supplier and then calls `platform.start()` on this same live stream.
|
|
161
|
+
*
|
|
162
|
+
* An instruction that arrives before a control plane exists is buffered by the
|
|
163
|
+
* platform connection and drained on the first `onInstruction` registration,
|
|
164
|
+
* so opening the stream early costs nothing.
|
|
165
|
+
*/
|
|
166
|
+
readonly platform: PlatformConnection;
|
|
167
|
+
/**
|
|
168
|
+
* DATA-PATH START. Two things, both data path:
|
|
169
|
+
*
|
|
170
|
+
* 1. arm heartbeat-driven reconnect detection on the platform stream, and
|
|
171
|
+
* 2. wait until Axon Server can route to the handlers subscribed on the bus
|
|
172
|
+
* streams.
|
|
173
|
+
*
|
|
174
|
+
* Call AFTER `kronos` — the subscribe frames must already be on the wire for
|
|
175
|
+
* the readiness wait to mean anything.
|
|
176
|
+
*
|
|
177
|
+
* Takes no arguments and arms no control-plane state.
|
|
178
|
+
*/
|
|
179
|
+
start(): Promise<void>;
|
|
180
|
+
/** Drain in-flight bus work, stop the platform stream, close the connection. */
|
|
181
|
+
close(): Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Connect to Axon Server and build the components it backs.
|
|
110
185
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
|
|
186
|
+
* `serializer` and `unitOfWorkFactory` are arguments rather than slot lookups:
|
|
187
|
+
* the buses serialize payloads with the former and run every inbound command /
|
|
188
|
+
* query in the latter, so they must be the SAME instances the rest of the app
|
|
189
|
+
* uses. Pass the ones you hand to `kronos`.
|
|
190
|
+
*/
|
|
191
|
+
export declare function axonServer(options: AxonServerOptions): Promise<AxonServerBackend>;
|
|
192
|
+
/**
|
|
193
|
+
* A command bus backed by Axon Server.
|
|
194
|
+
*
|
|
195
|
+
* - **Outbound dispatch**: Always goes through Axon Server via the unary Dispatch RPC.
|
|
196
|
+
* Axon Server routes the command to the appropriate node (which may be this one).
|
|
197
|
+
* - **Local segment**: Handlers subscribed via `subscribe()` are registered with
|
|
198
|
+
* Axon Server (so other nodes can route to us) and stored locally. When Axon Server
|
|
199
|
+
* routes an inbound command to this node, it's executed on the local segment
|
|
200
|
+
* within a UnitOfWork.
|
|
116
201
|
*/
|
|
117
|
-
|
|
202
|
+
/**
|
|
203
|
+
* A command bus backed by Axon Server.
|
|
204
|
+
*
|
|
205
|
+
* ## Correlation lineage and the interceptor layer
|
|
206
|
+
*
|
|
207
|
+
* The returned bus is wrapped in {@link interceptingCommandBus} carrying
|
|
208
|
+
* {@link correlationDataDispatchInterceptor}, so lineage is stamped onto the
|
|
209
|
+
* outgoing message BEFORE it is serialized onto the wire.
|
|
210
|
+
*
|
|
211
|
+
* This is precisely how the Java client does it. AF4's `AxonServerCommandBus`
|
|
212
|
+
* holds its own `DispatchInterceptors` and dispatches as
|
|
213
|
+
* `doDispatch(dispatchInterceptors.intercept(commandMessage), cb)` — one call
|
|
214
|
+
* site, at the top, ahead of any routing; and its `doDispatch` (like this one)
|
|
215
|
+
* always goes to the server, letting Axon Server decide where the command lands.
|
|
216
|
+
* AF5 keeps the property via decorator order:
|
|
217
|
+
* `DISTRIBUTED_COMMAND_BUS_ORDER = InterceptingCommandBus.DECORATION_ORDER - 50`
|
|
218
|
+
* stacks `InterceptingCommandBus → DistributedCommandBus → SimpleCommandBus`.
|
|
219
|
+
*
|
|
220
|
+
* Before this wrap, an Axon-backed service lost lineage on EVERY command: the
|
|
221
|
+
* only registration of `correlationDataDispatchInterceptor` lives in
|
|
222
|
+
* `@kronos-ts/app`'s in-memory default bus, and `components.commandBus` from
|
|
223
|
+
* this backend replaces it wholesale.
|
|
224
|
+
*
|
|
225
|
+
* No double-application risk: the local segment here is a plain handler map, not
|
|
226
|
+
* a `CommandBus`, so this is the only interceptor in the chain. Inbound commands
|
|
227
|
+
* from the server are invoked through that map directly, which matches AF —
|
|
228
|
+
* `CommandProcessingTask` runs the local segment WITHOUT re-running dispatch
|
|
229
|
+
* interceptors.
|
|
230
|
+
*/
|
|
231
|
+
export declare function distributedCommandBus(connection: AxonServerConnection, unitOfWorkRunner: UoWRunner, shutdownLatch: ShutdownLatch, serializer: Serializer, flowControl?: FlowControlConfig, commandLoadFactor?: number, resilience?: Partial<ResilienceConfig>): CommandBus;
|
|
118
232
|
/**
|
|
119
233
|
* A query bus backed by Axon Server.
|
|
120
234
|
*
|
|
@@ -123,6 +237,18 @@ export declare function axonServer(serverConfig: AxonServerExtensionConfig): (ap
|
|
|
123
237
|
* - **Local segment**: Handlers registered here are stored locally and
|
|
124
238
|
* registered with Axon Server for inbound routing. Inbound queries
|
|
125
239
|
* are executed within a UnitOfWork.
|
|
240
|
+
*
|
|
241
|
+
* Wrapped in {@link interceptingQueryBus} with
|
|
242
|
+
* {@link correlationDataDispatchInterceptor}, matching AF4's
|
|
243
|
+
* `AxonServerQueryBus`, which calls `dispatchInterceptors.intercept(...)` at the
|
|
244
|
+
* top of `query`, `streamingQuery`, `scatterGather` and `subscriptionQuery`.
|
|
245
|
+
* Because the wrap is outside, the `shortcutQueriesToLocalHandlers` branch in
|
|
246
|
+
* `query()` gets identical lineage to the remote branch.
|
|
247
|
+
*
|
|
248
|
+
* KNOWN GAP: `subscriptionQuery` / `subscribeToUpdates` build their proto
|
|
249
|
+
* straight from `message.metadata`, and `interceptingQueryBus` (in
|
|
250
|
+
* `@kronos-ts/messaging`) forwards those two calls to the delegate without
|
|
251
|
+
* running the dispatch chain. Closing that needs a messaging-package change.
|
|
126
252
|
*/
|
|
127
|
-
export declare function
|
|
253
|
+
export declare function distributedQueryBus(connection: AxonServerConnection, unitOfWorkRunner: UoWRunner, shutdownLatch: ShutdownLatch, serializer: Serializer, flowControl?: FlowControlConfig, shortcutQueriesToLocalHandlers?: boolean, queryTimeoutMs?: number, resilience?: Partial<ResilienceConfig>): QueryBus;
|
|
128
254
|
//# sourceMappingURL=axon-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server.d.ts","sourceRoot":"","sources":["../src/axon-server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"axon-server.d.ts","sourceRoot":"","sources":["../src/axon-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,OAAO,EAIL,KAAK,UAAU,EAGf,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EAIR,SAAS,EAEV,MAAM,sBAAsB,CAAA;AAU7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAIzE,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAA;AAM9B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA0DD,MAAM,WAAW,gBAAiB,SAAQ,0BAA0B;IAClE,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,iBAAiB,CAAA;IACtC,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,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