@chidchanun/bcp 0.2.11 → 0.2.12
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 +199 -327
- package/docs/README.md +53 -56
- package/docs/api-manifest.json +17 -2
- package/docs/api-reference.md +94 -118
- package/docs/docs-web-manifest.json +7 -5
- package/docs/platform-manifest.json +16 -4
- package/docs/releases/0.2.12.md +147 -0
- package/docs/transactional-outbox-events.md +465 -0
- package/package.json +6 -1
- package/packages/bundler/src/client-boundary.ts +1 -0
- package/packages/client/src/events.mjs +889 -0
- package/packages/client/src/events.ts +31 -0
- package/packages/server/src/events.ts +1416 -0
package/docs/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
The `docs/` directory is the documentation source of truth for BCP Framework and is organized for **`bcp-docs-web`**.
|
|
4
4
|
|
|
5
|
-
> **Documentation target:** BCP Framework `0.2.
|
|
5
|
+
> **Documentation target:** BCP Framework `0.2.12 — Transactional Outbox & Events`
|
|
6
6
|
>
|
|
7
7
|
> **Release state:** unreleased development target until RC validation, tagging and npm publication complete.
|
|
8
8
|
|
|
9
9
|
## Documentation architecture
|
|
10
10
|
|
|
11
|
-
BCP uses three machine-readable
|
|
11
|
+
BCP uses three machine-readable contracts:
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
14
|
docs/docs-web-manifest.json
|
|
@@ -39,53 +39,55 @@ Framework source and tests remain authoritative for runtime behavior.
|
|
|
39
39
|
| `0.2.9` | Job Scheduling Platform |
|
|
40
40
|
| `0.2.10` | Durable Jobs Platform |
|
|
41
41
|
| `0.2.11` | Workflow Orchestration |
|
|
42
|
+
| `0.2.12` | Transactional Outbox & Events |
|
|
42
43
|
|
|
43
|
-
## 0.2.
|
|
44
|
+
## 0.2.12 — Transactional Outbox & Events
|
|
44
45
|
|
|
45
|
-
`0.2.
|
|
46
|
-
|
|
47
|
-
New/updated documentation sources:
|
|
48
|
-
|
|
49
|
-
| Source | Purpose |
|
|
50
|
-
| --- | --- |
|
|
51
|
-
| `workflow-orchestration.md` | Workflow definition, persistence, delays, retries, queue execution and compensation |
|
|
52
|
-
| `durable-jobs.md` | Durable execution layer used by queue-backed workflows |
|
|
53
|
-
| `api-reference.md` | Public `bcp/workflow` APIs |
|
|
54
|
-
| `platform-manifest.json` | Workflow capability flags and public entrypoint |
|
|
55
|
-
| `api-manifest.json` | `bcp/workflow` source/guide ownership |
|
|
56
|
-
| `docs-web-manifest.json` | Workflow docs navigation and `0.2.11` release route |
|
|
57
|
-
| `releases/0.2.11.md` | Workflow Orchestration release notes |
|
|
46
|
+
`0.2.12` adds the server-only `bcp/events` public entrypoint.
|
|
58
47
|
|
|
59
48
|
Primary APIs:
|
|
60
49
|
|
|
61
50
|
```ts
|
|
62
51
|
import {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
createEventBus,
|
|
53
|
+
createMemoryOutboxStore,
|
|
54
|
+
createOutboxDispatcher,
|
|
55
|
+
createOutboxMigrationSql,
|
|
56
|
+
createSqlOutboxStore,
|
|
57
|
+
createTransactionalOutbox,
|
|
58
|
+
} from "bcp/events";
|
|
66
59
|
```
|
|
67
60
|
|
|
68
|
-
|
|
61
|
+
The central write model is:
|
|
69
62
|
|
|
70
63
|
```text
|
|
71
|
-
|
|
64
|
+
BCP Database transaction
|
|
72
65
|
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
v
|
|
77
|
-
BCP Workflow
|
|
66
|
+
+-- business data
|
|
67
|
+
+-- SQL outbox event
|
|
78
68
|
|
|
|
79
|
-
|
|
80
|
-
+--> parallel groups
|
|
81
|
-
+--> retry / delay
|
|
82
|
-
+--> compensation
|
|
69
|
+
COMMIT
|
|
83
70
|
|
|
|
84
71
|
v
|
|
85
|
-
|
|
72
|
+
Outbox Dispatcher
|
|
73
|
+
|
|
|
74
|
+
+-- bcp/jobs
|
|
75
|
+
+-- custom publisher
|
|
76
|
+
+-- local EventBus
|
|
86
77
|
```
|
|
87
78
|
|
|
88
|
-
|
|
79
|
+
`createSqlOutboxStore()` supports MySQL, PostgreSQL and SQLite and writes the event using the caller-provided `TransactionDatabase`. The dispatcher adds leasing, stale recovery, retry/backoff and terminal failure handling after commit.
|
|
80
|
+
|
|
81
|
+
New/updated documentation sources:
|
|
82
|
+
|
|
83
|
+
| Source | Purpose |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `transactional-outbox-events.md` | Transactional publishing, SQL migration, dispatcher lifecycle and delivery guarantees |
|
|
86
|
+
| `api-reference.md` | `bcp/events` public APIs |
|
|
87
|
+
| `platform-manifest.json` | Events capability flags and public entrypoint |
|
|
88
|
+
| `api-manifest.json` | `bcp/events` source/guide ownership |
|
|
89
|
+
| `docs-web-manifest.json` | Outbox docs navigation and `0.2.12` release route |
|
|
90
|
+
| `releases/0.2.12.md` | Transactional Outbox & Events release notes |
|
|
89
91
|
|
|
90
92
|
## Update rule
|
|
91
93
|
|
|
@@ -94,15 +96,13 @@ When framework behavior or public surface changes:
|
|
|
94
96
|
1. Update framework source.
|
|
95
97
|
2. Add/update regression tests.
|
|
96
98
|
3. Update the matching Markdown guide.
|
|
97
|
-
4. Update `platform-manifest.json`
|
|
98
|
-
5. Update `api-manifest.json`
|
|
99
|
-
6. Update `docs-web-manifest.json`
|
|
99
|
+
4. Update `platform-manifest.json` for runtime/public-entrypoint/capability changes.
|
|
100
|
+
5. Update `api-manifest.json` for public API ownership/guide changes.
|
|
101
|
+
6. Update `docs-web-manifest.json` for website route/navigation changes.
|
|
100
102
|
7. Update `docs/releases/<version>.md`.
|
|
101
103
|
8. Change release state only after the release workflow reaches that state.
|
|
102
104
|
|
|
103
|
-
##
|
|
104
|
-
|
|
105
|
-
Important current routes:
|
|
105
|
+
## Important docs-web routes
|
|
106
106
|
|
|
107
107
|
| Website route | Markdown source |
|
|
108
108
|
| --- | --- |
|
|
@@ -113,17 +113,15 @@ Important current routes:
|
|
|
113
113
|
| `/docs/job-scheduling` | `job-scheduling.md` |
|
|
114
114
|
| `/docs/durable-jobs` | `durable-jobs.md` |
|
|
115
115
|
| `/docs/workflow-orchestration` | `workflow-orchestration.md` |
|
|
116
|
-
| `/docs/
|
|
116
|
+
| `/docs/transactional-outbox-events` | `transactional-outbox-events.md` |
|
|
117
117
|
| `/docs/database` | `database.md` |
|
|
118
118
|
| `/docs/api-reference` | `api-reference.md` |
|
|
119
|
-
| `/releases/0.2.
|
|
119
|
+
| `/releases/0.2.12` | `releases/0.2.12.md` |
|
|
120
120
|
|
|
121
121
|
Every route/source pair is validated by unit tests.
|
|
122
122
|
|
|
123
123
|
## Public entrypoints
|
|
124
124
|
|
|
125
|
-
Current documented entrypoints:
|
|
126
|
-
|
|
127
125
|
```text
|
|
128
126
|
bcp
|
|
129
127
|
bcp/island
|
|
@@ -135,6 +133,7 @@ bcp/database
|
|
|
135
133
|
bcp/auth
|
|
136
134
|
bcp/jobs
|
|
137
135
|
bcp/workflow
|
|
136
|
+
bcp/events
|
|
138
137
|
bcp/observability
|
|
139
138
|
bcp/server
|
|
140
139
|
bcp/server-only
|
|
@@ -145,29 +144,27 @@ The API-manifest entrypoint set must match the platform public-entrypoint set ex
|
|
|
145
144
|
|
|
146
145
|
## Release validation
|
|
147
146
|
|
|
148
|
-
Before publishing `0.2.
|
|
147
|
+
Before publishing `0.2.12`:
|
|
149
148
|
|
|
150
149
|
```bash
|
|
151
150
|
npm run typecheck
|
|
152
151
|
npm run test:unit
|
|
153
152
|
npm run test:integration
|
|
154
|
-
npm run test:package
|
|
155
153
|
npm run test:e2e
|
|
154
|
+
npm run test:package
|
|
156
155
|
npm run rc:check
|
|
157
156
|
```
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
- server-only client boundary enforcement,
|
|
170
|
-
- compiled `workflow.mjs` package execution,
|
|
158
|
+
Transactional Outbox & Events validation covers:
|
|
159
|
+
|
|
160
|
+
- transaction-bound SQL outbox insertion,
|
|
161
|
+
- queue handoff,
|
|
162
|
+
- custom/event-bus delivery,
|
|
163
|
+
- retry and terminal failure,
|
|
164
|
+
- dispatcher lease recovery,
|
|
165
|
+
- MySQL/PostgreSQL/SQLite migration generation,
|
|
166
|
+
- server-only browser boundary enforcement,
|
|
167
|
+
- compiled `events.mjs` package execution,
|
|
171
168
|
- docs/platform/API version parity.
|
|
172
169
|
|
|
173
170
|
The final release tag must point to the exact commit that passed the complete RC sequence.
|
package/docs/api-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.12",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"coverage": "public-entrypoints",
|
|
7
7
|
"entrypoints": [
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"summary": "Provider-neutral MySQL, PostgreSQL and SQLite query, transaction, lifecycle and migration primitives.",
|
|
78
78
|
"guides": [
|
|
79
79
|
"/docs/database",
|
|
80
|
-
"/docs/database-migrations"
|
|
80
|
+
"/docs/database-migrations",
|
|
81
|
+
"/docs/transactional-outbox-events"
|
|
81
82
|
]
|
|
82
83
|
},
|
|
83
84
|
{
|
|
@@ -104,6 +105,7 @@
|
|
|
104
105
|
"/docs/background-jobs",
|
|
105
106
|
"/docs/job-scheduling",
|
|
106
107
|
"/docs/durable-jobs",
|
|
108
|
+
"/docs/transactional-outbox-events",
|
|
107
109
|
"/docs/observability"
|
|
108
110
|
]
|
|
109
111
|
},
|
|
@@ -119,6 +121,19 @@
|
|
|
119
121
|
"/docs/observability"
|
|
120
122
|
]
|
|
121
123
|
},
|
|
124
|
+
{
|
|
125
|
+
"package": "bcp/events",
|
|
126
|
+
"source": "packages/client/src/events.ts",
|
|
127
|
+
"environment": "server",
|
|
128
|
+
"route": "/docs/api-reference#bcp-events",
|
|
129
|
+
"summary": "Transactional outbox and event delivery APIs with SQL persistence, dispatcher leases, retries, stale recovery, queue handoff and in-process event bus delivery.",
|
|
130
|
+
"guides": [
|
|
131
|
+
"/docs/transactional-outbox-events",
|
|
132
|
+
"/docs/database",
|
|
133
|
+
"/docs/durable-jobs",
|
|
134
|
+
"/docs/observability"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
122
137
|
{
|
|
123
138
|
"package": "bcp/observability",
|
|
124
139
|
"source": "packages/client/src/observability.ts",
|
package/docs/api-reference.md
CHANGED
|
@@ -54,7 +54,7 @@ Server-only Database Platform v2 APIs.
|
|
|
54
54
|
|
|
55
55
|
Built-in SQL providers are MySQL, PostgreSQL and SQLite. `BcpDatabase` instances expose lazy query/execute/transaction operations plus explicit `connect()`, `disconnect()` and backward-compatible `close()` lifecycle methods.
|
|
56
56
|
|
|
57
|
-
Related guides: [Database](database.md), [Database Migrations](database-migrations.md).
|
|
57
|
+
Related guides: [Database](database.md), [Database Migrations](database-migrations.md), [Transactional Outbox & Events](transactional-outbox-events.md).
|
|
58
58
|
|
|
59
59
|
## `bcp/auth`
|
|
60
60
|
|
|
@@ -68,104 +68,17 @@ Related guides: [Authentication](authentication.md), [Auth Session Stores](auth-
|
|
|
68
68
|
|
|
69
69
|
Server-only Background Jobs, Job Scheduling and Durable Jobs APIs.
|
|
70
70
|
|
|
71
|
-
Core queue APIs
|
|
71
|
+
Core queue APIs include `createJobQueue()`, `createMemoryJobQueueAdapter()`, queue/worker records, retry/backoff, visibility leases, heartbeat renewal, stale recovery, DLQ operations, retention cleanup and queue statistics.
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
import {
|
|
75
|
-
createJobQueue,
|
|
76
|
-
createMemoryJobQueueAdapter,
|
|
77
|
-
type BackgroundJobQueue,
|
|
78
|
-
type CleanupJobsOptions,
|
|
79
|
-
type DeadLetterJobRecord,
|
|
80
|
-
type EnqueueJobOptions,
|
|
81
|
-
type HeartbeatJobOptions,
|
|
82
|
-
type JobHandler,
|
|
83
|
-
type JobHandlerContext,
|
|
84
|
-
type JobQueueAdapter,
|
|
85
|
-
type JobQueueOptions,
|
|
86
|
-
type JobQueueStats,
|
|
87
|
-
type JobRecord,
|
|
88
|
-
type JobRetryDelay,
|
|
89
|
-
type JobState,
|
|
90
|
-
type JobWorker,
|
|
91
|
-
type MemoryJobQueueAdapter,
|
|
92
|
-
type ProcessNextJobOptions,
|
|
93
|
-
type RecoverStaleJobsOptions,
|
|
94
|
-
type RequeueDeadLetterOptions,
|
|
95
|
-
type ReserveJobOptions,
|
|
96
|
-
type StartJobWorkerOptions,
|
|
97
|
-
} from "bcp/jobs";
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Scheduling APIs:
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
import {
|
|
104
|
-
createJobScheduler,
|
|
105
|
-
createMemoryJobScheduleStore,
|
|
106
|
-
nextCronTime,
|
|
107
|
-
nextScheduleTime,
|
|
108
|
-
type JobSchedule,
|
|
109
|
-
type JobScheduleRecord,
|
|
110
|
-
type JobScheduleStore,
|
|
111
|
-
type JobScheduler,
|
|
112
|
-
type JobSchedulerOptions,
|
|
113
|
-
type JobSchedulerRunner,
|
|
114
|
-
type MemoryJobScheduleStore,
|
|
115
|
-
type RunDueSchedulesOptions,
|
|
116
|
-
type ScheduleJobOptions,
|
|
117
|
-
type StartJobSchedulerOptions,
|
|
118
|
-
} from "bcp/jobs";
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Durable Redis-compatible APIs added in `0.2.10`:
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
import {
|
|
125
|
-
createRedisJobQueueAdapter,
|
|
126
|
-
createRedisJobScheduleStore,
|
|
127
|
-
type RedisCommandClient,
|
|
128
|
-
type RedisJobQueueAdapter,
|
|
129
|
-
type RedisJobsAdapterOptions,
|
|
130
|
-
type RedisJobScheduleStore,
|
|
131
|
-
} from "bcp/jobs";
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Queue lifecycle
|
|
73
|
+
Scheduling APIs include `createJobScheduler()`, `createMemoryJobScheduleStore()`, `nextCronTime()` and `nextScheduleTime()`.
|
|
135
74
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
Durable adapter methods such as `heartbeat()`, `recoverStale()`, `listDeadLetters()`, `requeueDeadLetter()`, `cleanup()` and `stats()` are optional so earlier `JobQueueAdapter` implementations remain compatible.
|
|
139
|
-
|
|
140
|
-
`reserve()` receives an optional second `ReserveJobOptions` argument containing `ownerId` and `visibilityTimeoutMs`. Production durable adapters should use it to create an atomic visibility lease.
|
|
141
|
-
|
|
142
|
-
### Scheduling
|
|
143
|
-
|
|
144
|
-
`createJobScheduler()` supports recurring interval and UTC five-field cron schedules.
|
|
145
|
-
|
|
146
|
-
The scheduler leases due records from `JobScheduleStore`, then enqueues normal jobs using deterministic occurrence IDs. `nextCronTime()` and `nextScheduleTime()` are available for tooling and tests.
|
|
147
|
-
|
|
148
|
-
### Redis-compatible durable adapters
|
|
149
|
-
|
|
150
|
-
`createRedisJobQueueAdapter()` implements the queue contract on a shared Redis-compatible command client.
|
|
151
|
-
|
|
152
|
-
`createRedisJobScheduleStore()` implements the schedule-store contract using the same minimal client shape:
|
|
153
|
-
|
|
154
|
-
```ts
|
|
155
|
-
interface RedisCommandClient {
|
|
156
|
-
sendCommand(
|
|
157
|
-
command: string[]
|
|
158
|
-
): Promise<unknown>;
|
|
159
|
-
}
|
|
160
|
-
```
|
|
75
|
+
Durable Redis-compatible APIs added in `0.2.10` include `createRedisJobQueueAdapter()` and `createRedisJobScheduleStore()`.
|
|
161
76
|
|
|
162
77
|
BCP does not install a Redis library and does not create the connection. Applications own authentication, TLS, Cluster/Sentinel configuration and connection shutdown.
|
|
163
78
|
|
|
164
|
-
The reference adapters use atomic Lua state transitions. The default namespace `bcp:{jobs}` uses a Redis Cluster hash tag so all job/schedule keys share one slot.
|
|
165
|
-
|
|
166
79
|
The processing model is at-least-once. Handlers that perform non-idempotent external side effects should use application-level idempotency protection.
|
|
167
80
|
|
|
168
|
-
Related guides: [Background Jobs Platform](background-jobs.md), [Job Scheduling Platform](job-scheduling.md), [Durable Jobs Platform](durable-jobs.md), [Observability Platform v2](observability.md).
|
|
81
|
+
Related guides: [Background Jobs Platform](background-jobs.md), [Job Scheduling Platform](job-scheduling.md), [Durable Jobs Platform](durable-jobs.md), [Transactional Outbox & Events](transactional-outbox-events.md), [Observability Platform v2](observability.md).
|
|
169
82
|
|
|
170
83
|
## `bcp/workflow`
|
|
171
84
|
|
|
@@ -175,29 +88,10 @@ Server-only Workflow Orchestration APIs added in `0.2.11`.
|
|
|
175
88
|
import {
|
|
176
89
|
createMemoryWorkflowStore,
|
|
177
90
|
createWorkflow,
|
|
178
|
-
type CancelWorkflowOptions,
|
|
179
|
-
type MemoryWorkflowStore,
|
|
180
|
-
type ResumeWorkflowOptions,
|
|
181
|
-
type StartWorkflowOptions,
|
|
182
|
-
type Workflow,
|
|
183
|
-
type WorkflowBuilder,
|
|
184
|
-
type WorkflowCompensationHandler,
|
|
185
|
-
type WorkflowOptions,
|
|
186
|
-
type WorkflowParallelBuilder,
|
|
187
|
-
type WorkflowRetryDelay,
|
|
188
|
-
type WorkflowRunRecord,
|
|
189
|
-
type WorkflowRunState,
|
|
190
|
-
type WorkflowStepContext,
|
|
191
|
-
type WorkflowStepHandler,
|
|
192
|
-
type WorkflowStepKind,
|
|
193
|
-
type WorkflowStepOptions,
|
|
194
|
-
type WorkflowStepRecord,
|
|
195
|
-
type WorkflowStepState,
|
|
196
|
-
type WorkflowStore,
|
|
197
91
|
} from "bcp/workflow";
|
|
198
92
|
```
|
|
199
93
|
|
|
200
|
-
`createWorkflow()` defines
|
|
94
|
+
`createWorkflow()` defines persistent server-side workflows with sequential steps, parallel groups, per-step retry policies, persisted delays and compensation handlers.
|
|
201
95
|
|
|
202
96
|
Workflow controls include:
|
|
203
97
|
|
|
@@ -213,17 +107,99 @@ compensate()
|
|
|
213
107
|
close()
|
|
214
108
|
```
|
|
215
109
|
|
|
216
|
-
|
|
110
|
+
When an existing `BackgroundJobQueue` is supplied, workflow execution and delay continuation can run through `bcp/jobs`.
|
|
111
|
+
|
|
112
|
+
`WorkflowStore.claim()` / `release()` form the run-level lease boundary for multi-instance stores.
|
|
113
|
+
|
|
114
|
+
Related guides: [Workflow Orchestration](workflow-orchestration.md), [Durable Jobs Platform](durable-jobs.md), [Observability Platform v2](observability.md).
|
|
115
|
+
|
|
116
|
+
## `bcp/events`
|
|
117
|
+
|
|
118
|
+
Server-only Transactional Outbox & Events APIs added in `0.2.12`.
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import {
|
|
122
|
+
createEventBus,
|
|
123
|
+
createMemoryOutboxStore,
|
|
124
|
+
createOutboxDispatcher,
|
|
125
|
+
createOutboxMigrationSql,
|
|
126
|
+
createSqlOutboxStore,
|
|
127
|
+
createTransactionalOutbox,
|
|
128
|
+
type ClaimOutboxEventsOptions,
|
|
129
|
+
type CleanupOutboxOptions,
|
|
130
|
+
type EventBus,
|
|
131
|
+
type FailOutboxEventOptions,
|
|
132
|
+
type MemoryOutboxStore,
|
|
133
|
+
type OutboxDispatcher,
|
|
134
|
+
type OutboxDispatcherOptions,
|
|
135
|
+
type OutboxDispatcherRunner,
|
|
136
|
+
type OutboxEventHandler,
|
|
137
|
+
type OutboxEventHandlerContext,
|
|
138
|
+
type OutboxEventRecord,
|
|
139
|
+
type OutboxEventState,
|
|
140
|
+
type OutboxRetryDelay,
|
|
141
|
+
type OutboxStats,
|
|
142
|
+
type OutboxStore,
|
|
143
|
+
type PublishOutboxEventOptions,
|
|
144
|
+
type SqlOutboxStore,
|
|
145
|
+
type SqlOutboxStoreOptions,
|
|
146
|
+
type TransactionalOutbox,
|
|
147
|
+
type TransactionalOutboxOptions,
|
|
148
|
+
} from "bcp/events";
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Transactional publishing
|
|
217
152
|
|
|
218
|
-
|
|
153
|
+
`createTransactionalOutbox()` exposes `publish(transaction, type, payload, options)`.
|
|
219
154
|
|
|
220
|
-
`
|
|
155
|
+
The supplied `TransactionDatabase` is the same object received inside `db.transaction()`, allowing the application row and outbox event row to commit or roll back together.
|
|
221
156
|
|
|
222
|
-
|
|
157
|
+
### SQL store
|
|
223
158
|
|
|
224
|
-
|
|
159
|
+
`createSqlOutboxStore()` supports MySQL, PostgreSQL and SQLite through the existing BCP database abstraction.
|
|
225
160
|
|
|
226
|
-
|
|
161
|
+
`createOutboxMigrationSql()` generates the outbox table/index DDL for those providers.
|
|
162
|
+
|
|
163
|
+
The SQL store persists payload/metadata, correlation/causation/aggregate IDs, retry counts, state timestamps and dispatcher lease information.
|
|
164
|
+
|
|
165
|
+
### Dispatcher
|
|
166
|
+
|
|
167
|
+
`createOutboxDispatcher()` supports:
|
|
168
|
+
|
|
169
|
+
```text
|
|
170
|
+
batched claim
|
|
171
|
+
dispatcher lease
|
|
172
|
+
stale recovery
|
|
173
|
+
retry/backoff
|
|
174
|
+
terminal failure
|
|
175
|
+
durable job queue handoff
|
|
176
|
+
custom publisher callback
|
|
177
|
+
in-process EventBus delivery
|
|
178
|
+
runner lifecycle
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
With `queue` configured, event `order.created` is enqueued as `event.order.created` using stable job ID `outbox:<event-id>`.
|
|
182
|
+
|
|
183
|
+
### Stores
|
|
184
|
+
|
|
185
|
+
`OutboxStore` is the persistence and concurrency boundary.
|
|
186
|
+
|
|
187
|
+
`createMemoryOutboxStore()` is intended for tests and single-process development. It does not provide durable transactional persistence.
|
|
188
|
+
|
|
189
|
+
### States
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
pending
|
|
193
|
+
processing
|
|
194
|
+
published
|
|
195
|
+
failed
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`published` means the configured dispatcher destination accepted the event. It does not mean a downstream queued consumer has completed.
|
|
199
|
+
|
|
200
|
+
Delivery is at-least-once; consumers should use idempotency controls for non-repeatable external side effects.
|
|
201
|
+
|
|
202
|
+
Related guides: [Transactional Outbox & Events](transactional-outbox-events.md), [Database](database.md), [Durable Jobs Platform](durable-jobs.md), [Observability Platform v2](observability.md).
|
|
227
203
|
|
|
228
204
|
## `bcp/observability`
|
|
229
205
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"versionTarget": "0.2.
|
|
4
|
+
"versionTarget": "0.2.12",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"sections": [
|
|
7
7
|
{
|
|
@@ -48,16 +48,17 @@
|
|
|
48
48
|
{
|
|
49
49
|
"id": "database",
|
|
50
50
|
"title": "Database",
|
|
51
|
-
"description": "Provider-neutral MySQL, PostgreSQL and SQLite primitives, lifecycle and
|
|
51
|
+
"description": "Provider-neutral MySQL, PostgreSQL and SQLite primitives, lifecycle, migrations and transactional outbox integration.",
|
|
52
52
|
"pages": [
|
|
53
53
|
{ "route": "/docs/database", "source": "database.md", "title": "Database" },
|
|
54
|
-
{ "route": "/docs/database-migrations", "source": "database-migrations.md", "title": "Database Migrations" }
|
|
54
|
+
{ "route": "/docs/database-migrations", "source": "database-migrations.md", "title": "Database Migrations" },
|
|
55
|
+
{ "route": "/docs/transactional-outbox-events", "source": "transactional-outbox-events.md", "title": "Transactional Outbox & Events" }
|
|
55
56
|
]
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
59
|
"id": "runtime",
|
|
59
60
|
"title": "Runtime & Infrastructure",
|
|
60
|
-
"description": "Middleware, durable background jobs, scheduling, workflow orchestration, observability, logging, caching, security and production hardening.",
|
|
61
|
+
"description": "Middleware, durable background jobs, scheduling, workflow orchestration, event delivery, observability, logging, caching, security and production hardening.",
|
|
61
62
|
"pages": [
|
|
62
63
|
{ "route": "/docs/middleware", "source": "middleware.md", "title": "Middleware" },
|
|
63
64
|
{ "route": "/docs/hydration", "source": "hydration.md", "title": "Hydration" },
|
|
@@ -112,7 +113,8 @@
|
|
|
112
113
|
}
|
|
113
114
|
],
|
|
114
115
|
"releases": [
|
|
115
|
-
{ "route": "/releases/0.2.
|
|
116
|
+
{ "route": "/releases/0.2.12", "source": "releases/0.2.12.md", "version": "0.2.12", "state": "unreleased" },
|
|
117
|
+
{ "route": "/releases/0.2.11", "source": "releases/0.2.11.md", "version": "0.2.11" },
|
|
116
118
|
{ "route": "/releases/0.2.10", "source": "releases/0.2.10.md", "version": "0.2.10" },
|
|
117
119
|
{ "route": "/releases/0.2.9", "source": "releases/0.2.9.md", "version": "0.2.9" },
|
|
118
120
|
{ "route": "/releases/0.2.8", "source": "releases/0.2.8.md", "version": "0.2.8" },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.12",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
|
-
"baseline": "
|
|
6
|
+
"baseline": "transactional-outbox-events",
|
|
7
7
|
"runtime": {
|
|
8
8
|
"node": ">=24.11.0",
|
|
9
9
|
"react": "19",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"bcp/auth",
|
|
22
22
|
"bcp/jobs",
|
|
23
23
|
"bcp/workflow",
|
|
24
|
+
"bcp/events",
|
|
24
25
|
"bcp/observability",
|
|
25
26
|
"bcp/server",
|
|
26
27
|
"bcp/server-only",
|
|
@@ -100,6 +101,16 @@
|
|
|
100
101
|
"workflowDelays": true,
|
|
101
102
|
"workflowCompensation": true,
|
|
102
103
|
"workflowQueueExecution": true,
|
|
104
|
+
"transactionalOutboxEvents": true,
|
|
105
|
+
"outboxStoreContract": true,
|
|
106
|
+
"sqlOutboxStore": true,
|
|
107
|
+
"outboxDispatcher": true,
|
|
108
|
+
"outboxDispatcherLeases": true,
|
|
109
|
+
"outboxRetryRecovery": true,
|
|
110
|
+
"outboxRetentionCleanup": true,
|
|
111
|
+
"outboxStatistics": true,
|
|
112
|
+
"eventBus": true,
|
|
113
|
+
"outboxJobDelivery": true,
|
|
103
114
|
"databaseMigrations": true,
|
|
104
115
|
"databaseAdapterContract": true,
|
|
105
116
|
"databasePostgresql": true,
|
|
@@ -139,7 +150,7 @@
|
|
|
139
150
|
"s3-compatible"
|
|
140
151
|
],
|
|
141
152
|
"compatibility": {
|
|
142
|
-
"previousBaseline": "0.2.
|
|
153
|
+
"previousBaseline": "0.2.11",
|
|
143
154
|
"intentionalBreakingChangesFromPreviousBaseline": false,
|
|
144
155
|
"migrationGuide": "migration-0.2.md"
|
|
145
156
|
},
|
|
@@ -160,7 +171,8 @@
|
|
|
160
171
|
"jobScheduling": "job-scheduling.md",
|
|
161
172
|
"durableJobs": "durable-jobs.md",
|
|
162
173
|
"workflowOrchestration": "workflow-orchestration.md",
|
|
174
|
+
"transactionalOutboxEvents": "transactional-outbox-events.md",
|
|
163
175
|
"migrationGuide": "migration-0.2.md",
|
|
164
|
-
"releaseNotes": "releases/0.2.
|
|
176
|
+
"releaseNotes": "releases/0.2.12.md"
|
|
165
177
|
}
|
|
166
178
|
}
|