@kronos-ts/axon-server 0.3.2 → 0.5.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 +3 -15
- package/dist/axon-server-event-store.d.ts.map +1 -1
- package/dist/axon-server-event-store.js +85 -44
- package/dist/axon-server-event-store.js.map +1 -1
- package/dist/axon-server-snapshotting-event-store.d.ts +30 -0
- package/dist/axon-server-snapshotting-event-store.d.ts.map +1 -0
- package/dist/axon-server-snapshotting-event-store.js +153 -0
- package/dist/axon-server-snapshotting-event-store.js.map +1 -0
- package/dist/axon-server.d.ts +92 -208
- package/dist/axon-server.d.ts.map +1 -1
- package/dist/axon-server.js +221 -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.d.ts +134 -4
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +135 -10
- package/dist/connection.js.map +1 -1
- package/dist/context-view.d.ts +30 -0
- package/dist/context-view.d.ts.map +1 -0
- package/dist/context-view.js +19 -0
- package/dist/context-view.js.map +1 -0
- package/dist/control-plane.d.ts +18 -17
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +8 -6
- package/dist/control-plane.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/event-processor-info.d.ts +4 -4
- package/dist/event-processor-info.d.ts.map +1 -1
- package/dist/flow-controlled-sender.d.ts +2 -2
- package/dist/flow-controlled-sender.d.ts.map +1 -1
- package/dist/flow-controlled-sender.js.map +1 -1
- package/dist/generated/command.d.ts +20 -20
- package/dist/generated/command.d.ts.map +1 -1
- package/dist/generated/command.js.map +1 -1
- package/dist/generated/common.d.ts +20 -20
- package/dist/generated/common.d.ts.map +1 -1
- package/dist/generated/common.js.map +1 -1
- package/dist/generated/control.d.ts +36 -40
- package/dist/generated/control.d.ts.map +1 -1
- package/dist/generated/control.js.map +1 -1
- package/dist/generated/dcb.d.ts +88 -94
- package/dist/generated/dcb.d.ts.map +1 -1
- package/dist/generated/dcb.js.map +1 -1
- package/dist/generated/event.d.ts +81 -84
- package/dist/generated/event.d.ts.map +1 -1
- package/dist/generated/event.js.map +1 -1
- package/dist/generated/google/protobuf/empty.d.ts +3 -4
- package/dist/generated/google/protobuf/empty.d.ts.map +1 -1
- package/dist/generated/google/protobuf/empty.js.map +1 -1
- package/dist/generated/query.d.ts +40 -40
- package/dist/generated/query.d.ts.map +1 -1
- package/dist/generated/query.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/message-size.d.ts +2 -2
- package/dist/message-size.d.ts.map +1 -1
- package/dist/metadata-conversion.d.ts +1 -1
- package/dist/metadata-conversion.d.ts.map +1 -1
- package/dist/outbound-stream.d.ts +2 -2
- package/dist/outbound-stream.d.ts.map +1 -1
- package/dist/platform-service.d.ts +4 -4
- package/dist/platform-service.d.ts.map +1 -1
- package/dist/resilience.d.ts +62 -0
- package/dist/resilience.d.ts.map +1 -0
- package/dist/resilience.js +103 -0
- package/dist/resilience.js.map +1 -0
- package/dist/shutdown-latch.d.ts +4 -4
- package/dist/shutdown-latch.d.ts.map +1 -1
- package/dist/shutdown-latch.js.map +1 -1
- package/package.json +5 -9
- package/src/axon-server-event-store.ts +97 -57
- package/src/axon-server-snapshotting-event-store.ts +191 -0
- package/src/axon-server.ts +365 -524
- package/src/connection-manager.ts +1 -1
- package/src/connection.ts +274 -20
- package/src/context-view.ts +46 -0
- package/src/control-plane.ts +19 -19
- package/src/event-processor-info.ts +2 -2
- package/src/flow-controlled-sender.ts +1 -1
- package/src/generated/command.ts +10 -10
- package/src/generated/common.ts +10 -10
- package/src/generated/control.ts +20 -20
- package/src/generated/dcb.ts +47 -47
- package/src/generated/event.ts +42 -42
- package/src/generated/google/protobuf/empty.ts +2 -2
- package/src/generated/query.ts +20 -20
- package/src/index.ts +12 -18
- package/src/message-size.ts +1 -1
- package/src/metadata-conversion.ts +1 -1
- package/src/outbound-stream.ts +1 -1
- package/src/platform-service.ts +2 -2
- package/src/resilience.ts +149 -0
- package/src/shutdown-latch.ts +2 -2
- package/dist/axon-server-snapshot-store.d.ts +0 -12
- package/dist/axon-server-snapshot-store.d.ts.map +0 -1
- package/dist/axon-server-snapshot-store.js +0 -88
- package/dist/axon-server-snapshot-store.js.map +0 -1
- package/src/axon-server-snapshot-store.ts +0 -118
package/dist/axon-server.d.ts
CHANGED
|
@@ -1,254 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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:
|
|
44
|
-
*
|
|
45
|
-
* - CLIENT_SUPPORTS_STREAMING capability advertised on every dispatched
|
|
46
|
-
* query via `defaultQueryInstructions(...)`;
|
|
47
|
-
* - AxonIQ-Context + AxonIQ-Access-Token gRPC metadata headers built by
|
|
48
|
-
* `createAxonMetadata(...)` and attached to every outbound stream/RPC;
|
|
49
|
-
* - permits-AFTER-subscriptions stream ordering preserved on the initial
|
|
50
|
-
* handshake AND on reconnect (see `ensureStreamStarted` /
|
|
51
|
-
* `reestablishStreamBody`);
|
|
52
|
-
* - shutdown ordering: busLatches → platform.stop → connection.close.
|
|
53
|
-
*/
|
|
54
|
-
import { type Serializer, type ResilienceConfig } from "@kronos-ts/common";
|
|
55
|
-
import type { CommandBus, QueryBus, UoWRunner } from "@kronos-ts/messaging";
|
|
56
|
-
import type { AxonServerConnectionConfig } from "./connection.js";
|
|
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";
|
|
60
|
-
import { type ShutdownLatch } from "./shutdown-latch.js";
|
|
61
|
-
import { type PlatformConnection, type PlatformServiceOptions } from "./platform-service.js";
|
|
1
|
+
import { type ResilienceConfig } from "./resilience.js";
|
|
2
|
+
import type { CommandBus, QueryBus, UnitOfWork } from "@kronos-ts/core";
|
|
3
|
+
import type { AxonServerBusSource } from "./connection.js";
|
|
62
4
|
/**
|
|
63
5
|
* Flow control configuration for a bus channel.
|
|
64
6
|
*/
|
|
65
|
-
export
|
|
7
|
+
export type FlowControlConfig = {
|
|
66
8
|
/** Initial permits granted to Axon Server. Default: 5000 (aligned with Java). */
|
|
67
9
|
permits?: number;
|
|
68
10
|
/** Threshold at which to request more permits. Default: 2500 (aligned with Java). */
|
|
69
11
|
refillThreshold?: number;
|
|
70
|
-
}
|
|
12
|
+
};
|
|
71
13
|
/**
|
|
72
14
|
* Processing instructions attached to outbound messages.
|
|
73
15
|
* Controls routing, priority, and timeout behavior on Axon Server.
|
|
74
16
|
*/
|
|
75
|
-
export
|
|
17
|
+
export type ProcessingInstructions = {
|
|
76
18
|
/** Routing key for consistent hashing (e.g., aggregate ID). */
|
|
77
19
|
routingKey?: string;
|
|
78
20
|
/** Priority (higher = processed first). Default: 0 */
|
|
79
21
|
priority?: number;
|
|
80
22
|
/** Timeout in ms. Axon Server cancels the command/query if not handled in time. */
|
|
81
23
|
timeoutMs?: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Tuning for {@link axonServerCommandBus}. Every field has a working default;
|
|
27
|
+
* the two arguments that carry meaning — the connection and your next bus —
|
|
28
|
+
* are positional, and this record is the trailing remainder.
|
|
29
|
+
*/
|
|
30
|
+
export type AxonServerCommandBusOptions = {
|
|
31
|
+
/** Axon Server context for this bus's stream. Default: the connection's. */
|
|
32
|
+
context?: string;
|
|
33
|
+
/** Flow control for the command stream. */
|
|
34
|
+
flowControl?: FlowControlConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Load factor for this command handler. Signals to Axon Server how much
|
|
37
|
+
* capacity this node has — higher value = more commands routed here.
|
|
38
|
+
* Aligned with Java's `commandLoadFactor`. Default: 100.
|
|
39
|
+
*/
|
|
40
|
+
loadFactor?: number;
|
|
41
|
+
/** Retry policy for stream re-establishment. Default: the connection's. */
|
|
42
|
+
resilience?: Partial<ResilienceConfig>;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Tuning for {@link axonServerQueryBus}. See {@link AxonServerCommandBusOptions}.
|
|
46
|
+
*/
|
|
47
|
+
export type AxonServerQueryBusOptions = {
|
|
48
|
+
/** Axon Server context for this bus's stream. Default: the connection's. */
|
|
49
|
+
context?: string;
|
|
50
|
+
/** Flow control for the query stream. */
|
|
51
|
+
flowControl?: FlowControlConfig;
|
|
90
52
|
/**
|
|
91
|
-
* When true, queries are first checked against locally
|
|
53
|
+
* When true, queries are first checked against locally subscribed handlers
|
|
92
54
|
* before being dispatched through Axon Server. Avoids a network round-trip
|
|
93
55
|
* when the handler is co-located.
|
|
94
56
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
57
|
+
* This is NOT the rabbitmq `preferLocal` fork by another name: it is Java's
|
|
58
|
+
* `shortcutQueriesToLocalHandlers`, it is off by default, and commands have
|
|
59
|
+
* no equivalent — Axon Server routes those, always.
|
|
97
60
|
*/
|
|
98
61
|
shortcutQueriesToLocalHandlers?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Load factor for command handler registration.
|
|
101
|
-
* Signals to Axon Server how much capacity this handler has.
|
|
102
|
-
* Higher value = handler can take more commands.
|
|
103
|
-
*
|
|
104
|
-
* Aligned with Java's `commandLoadFactor`. Default: 100.
|
|
105
|
-
*/
|
|
106
|
-
commandLoadFactor?: number;
|
|
107
|
-
/**
|
|
108
|
-
* Default timeout for command dispatch in ms. Default: 300000 (5 min).
|
|
109
|
-
* Aligned with Java's processing instruction timeout.
|
|
110
|
-
*/
|
|
111
|
-
commandTimeoutMs?: number;
|
|
112
62
|
/**
|
|
113
63
|
* Default timeout for query dispatch in ms. Default: 3600000 (1 hour).
|
|
114
64
|
* Aligned with Java's processing instruction timeout.
|
|
115
65
|
*/
|
|
116
|
-
|
|
117
|
-
/**
|
|
66
|
+
timeoutMs?: number;
|
|
67
|
+
/** Retry policy for stream re-establishment. Default: the connection's. */
|
|
118
68
|
resilience?: Partial<ResilienceConfig>;
|
|
119
|
-
/**
|
|
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.
|
|
130
|
-
*/
|
|
131
|
-
busSubscriptionAckDelayMs?: number;
|
|
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
|
-
}
|
|
140
|
-
/**
|
|
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
69
|
};
|
|
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.
|
|
185
|
-
*
|
|
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
70
|
/**
|
|
193
|
-
* A command bus backed by Axon Server.
|
|
71
|
+
* A command bus backed by Axon Server, over YOUR next bus.
|
|
72
|
+
*
|
|
73
|
+
* - **Outbound dispatch**: ALWAYS through Axon Server, via the unary Dispatch
|
|
74
|
+
* RPC. Axon Server routes the command to the appropriate node (which may be
|
|
75
|
+
* this one). There is deliberately no client-side prefer-next fork: the hub
|
|
76
|
+
* is the router, and short-circuiting it would silently defeat load factors,
|
|
77
|
+
* priorities and routing keys.
|
|
78
|
+
* - **Inbound**: a command the server routes here is dispatched into `next` —
|
|
79
|
+
* not into a privately-held handler map. That is what makes the unit-of-work
|
|
80
|
+
* policy you chose for `next` (say `postgresUnitOfWork(unitOfWork, pg)`)
|
|
81
|
+
* apply to server-routed work exactly as it applies to work this process
|
|
82
|
+
* originated. It is also why this function takes no `unitOfWork` argument:
|
|
83
|
+
* `next` carries that policy now.
|
|
84
|
+
* - **subscribe**: registers the handler on `next` AND announces the name to
|
|
85
|
+
* Axon Server, so other nodes can route to us.
|
|
86
|
+
*
|
|
87
|
+
* ## correlation and the interceptor layer
|
|
88
|
+
*
|
|
89
|
+
* The returned bus stamps no correlation of its own. A host that wants it wraps the
|
|
90
|
+
* OUTERMOST bus:
|
|
194
91
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
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.
|
|
201
|
-
*/
|
|
202
|
-
/**
|
|
203
|
-
* A command bus backed by Axon Server.
|
|
204
|
-
*
|
|
205
|
-
* ## Correlation lineage and the interceptor layer
|
|
92
|
+
* ```ts
|
|
93
|
+
* interceptingCommandBus(axonServerCommandBus(next, conn), correlation)
|
|
94
|
+
* ```
|
|
206
95
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
96
|
+
* so whatever a host adds runs BEFORE the message is serialized onto the wire.
|
|
97
|
+
* Correlation itself is usually already on `message.metadata` by then — `ctx.send`
|
|
98
|
+
* stamps the unit of work's correlation data before any bus sees the message.
|
|
210
99
|
*
|
|
211
100
|
* This is precisely how the Java client does it. AF4's `AxonServerCommandBus`
|
|
212
101
|
* holds its own `DispatchInterceptors` and dispatches as
|
|
213
102
|
* `doDispatch(dispatchInterceptors.intercept(commandMessage), cb)` — one call
|
|
214
|
-
* site, at the top, ahead of any routing
|
|
215
|
-
*
|
|
216
|
-
*
|
|
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.
|
|
103
|
+
* site, at the top, ahead of any routing. AF5 keeps the property via decorator
|
|
104
|
+
* order: `DISTRIBUTED_COMMAND_BUS_ORDER = InterceptingCommandBus.DECORATION_ORDER - 50`
|
|
105
|
+
* stacks `InterceptingCommandBus → DistributedCommandBus → LocalCommandBus`.
|
|
224
106
|
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* `CommandProcessingTask` runs the local segment WITHOUT re-running dispatch
|
|
229
|
-
* interceptors.
|
|
107
|
+
* If `next` is itself an intercepting bus, a server-routed command sees
|
|
108
|
+
* `correlation` twice. That is harmless: both of its fields are `??` seeds, so the
|
|
109
|
+
* second application finds them set and changes nothing.
|
|
230
110
|
*/
|
|
231
|
-
export declare function
|
|
111
|
+
export declare function axonServerCommandBus<U extends UnitOfWork = UnitOfWork>(next: CommandBus<U>, conn: AxonServerBusSource, options?: AxonServerCommandBusOptions): CommandBus<U>;
|
|
232
112
|
/**
|
|
233
|
-
* A query bus backed by Axon Server.
|
|
113
|
+
* A query bus backed by Axon Server, over YOUR next bus.
|
|
114
|
+
*
|
|
115
|
+
* Same architecture as {@link axonServerCommandBus}: outbound dispatch goes
|
|
116
|
+
* through Axon Server, and a query the server routes here runs through `next`,
|
|
117
|
+
* so your unit-of-work policy applies to server-routed reads too. `subscribe`
|
|
118
|
+
* registers on `next` and announces the name to the server.
|
|
234
119
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
120
|
+
* The one asymmetry with commands is `shortcutQueriesToLocalHandlers` — Java
|
|
121
|
+
* has it for queries and not for commands, and so do we. When it is on and this
|
|
122
|
+
* node subscribed the name, `query()` goes straight to `next` and the caller's
|
|
123
|
+
* unit of work is passed through, so the next branch nests exactly as the
|
|
124
|
+
* in-process bus does.
|
|
240
125
|
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* `
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* `query()` gets identical lineage to the remote branch.
|
|
126
|
+
* Correlation, if wanted, is `interceptingQueryBus(bus, correlation)` at the host,
|
|
127
|
+
* matching AF4's `AxonServerQueryBus`, which calls
|
|
128
|
+
* `dispatchInterceptors.intercept(...)` at the top of `query`, `streamingQuery`,
|
|
129
|
+
* `scatterGather` and `subscriptionQuery`. Because the wrap is outside, the
|
|
130
|
+
* shortcut branch gets identical correlation to the remote branch.
|
|
247
131
|
*
|
|
248
132
|
* KNOWN GAP: `subscriptionQuery` / `subscribeToUpdates` build their proto
|
|
249
133
|
* straight from `message.metadata`, and `interceptingQueryBus` (in
|
|
250
|
-
* `@kronos-ts/
|
|
251
|
-
* running the dispatch chain. Closing that needs a
|
|
134
|
+
* `@kronos-ts/core`) forwards those two calls to the delegate without
|
|
135
|
+
* running the dispatch chain. Closing that needs a core change.
|
|
252
136
|
*/
|
|
253
|
-
export declare function
|
|
137
|
+
export declare function axonServerQueryBus<U extends UnitOfWork = UnitOfWork>(next: QueryBus<U>, conn: AxonServerBusSource, options?: AxonServerQueryBusOptions): QueryBus<U>;
|
|
254
138
|
//# sourceMappingURL=axon-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon-server.d.ts","sourceRoot":"","sources":["../src/axon-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"axon-server.d.ts","sourceRoot":"","sources":["../src/axon-server.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EAIR,UAAU,EAEX,MAAM,iBAAiB,CAAA;AAMxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAgB1D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,+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,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACvC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B;;;;;;;;OAQG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACvC,CAAA;AAyED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACpE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EACnB,IAAI,EAAE,mBAAmB,EACzB,OAAO,GAAE,2BAAgC,GACxC,UAAU,CAAC,CAAC,CAAC,CAsOf;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAClE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,mBAAmB,EACzB,OAAO,GAAE,yBAA8B,GACtC,QAAQ,CAAC,CAAC,CAAC,CAmjBb"}
|