Commit 76d6c0c
authored
feat: migrate Payment Order, Market Info, Reconciliation to OutboxPublisher (#1312)
* feat: add canonical financial-accounting topic and dual-publish
Add FinancialAccountingBookingLogControlledV1 constant following the
standard <service>.<event-name>.<version> naming convention. The legacy
FinancialAccountingBookingLogControlled topic is deprecated but retained
for dual-publishing during migration. Both topics are written to the
outbox within the same transaction for backwards compatibility.
* feat: migrate market-information to OutboxPublisher
Replace KafkaObservationPublisher with OutboxEventPublisher that writes
events to the transactional outbox table via GORM. Add outbox worker
and Kafka producer wiring to cmd/main.go. The existing pgxpool
connection is retained for domain operations while GORM handles the
outbox pattern. Deprecated dual-publishing to the old topic name is
removed since the outbox publisher uses the canonical topic.
* feat: migrate reconciliation service to OutboxPublisher
Replace custom KafkaPublisher (JSON-based, dual-publishing) with the
shared OutboxPublisher pattern. Events are now written to the outbox
table within a GORM transaction and published to Kafka asynchronously
by the outbox worker.
- Create OutboxEventPublisher adapter with interface-based event routing
to avoid import cycles between messaging and service packages
- Add getter methods to DisputeCreatedEvent, DisputeResolvedEvent, and
PositionLockRequestedEvent for interface compliance
- Wire outbox worker and Kafka producer in cmd/main.go
- Remove deprecated dual-publishing to legacy topic names
* feat: migrate payment-order service to OutboxPublisher
Replace direct Kafka producer with the shared OutboxPublisher pattern.
Events are now written to the outbox table within a GORM transaction
and published to Kafka asynchronously by the outbox worker.
- Create OutboxPublisher adapter implementing service.KafkaPublisher
interface with topic-to-event-type mapping for all 7 payment order
lifecycle events (Initiated, Reserved, Executing, Completed, Failed,
Cancelled, Reversed)
- Wire outbox worker and Kafka producer in cmd/main.go
- Remove legacy createKafkaProducer function
- Add graceful shutdown for outbox worker and Kafka producer
* fix: address review feedback on outbox cleanup and unused code
- Add defer for kafkaProducer.Close() to prevent leaks on early return
in all three services (market-info, payment-order, reconciliation)
- Remove duplicate outbox worker/producer cleanup from orchestrator
and explicit shutdown sections (defer handles all paths)
- Remove unused period timestamp parsing in reconciliation outbox
publisher (proto message does not carry period fields)
- Improve warning message when outbox worker is disabled
* fix: correct outbox DSN config and defer ordering
- Set gormDBConfig.DSN = dbURL in market-information so outbox uses the
same database as domain persistence instead of the hardcoded fallback
- Move defer bootstrap.CloseDatabase earlier in payment-order so DB
closes after outbox worker stops (LIFO ordering)
- Remove stale createKafkaProducer doc comment
* fix: update topic tests for canonical V1 constant and deprecated exclusion
- Update TestAll_ContainsAllConstants to expect the new canonical
FinancialAccountingBookingLogControlledV1 constant instead of the
deprecated legacy constant
- Update TestTopicsYAML_ConsistentWithGoConstants to skip deprecated
topics when checking YAML-to-Go consistency, matching All()'s
documented behavior of excluding deprecated topics
- Add Deprecated field to topicEntry YAML struct for filtering
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent e7d4446 commit 76d6c0c
12 files changed
Lines changed: 528 additions & 45 deletions
File tree
- services
- financial-accounting/service
- market-information
- cmd
- service
- payment-order
- adapters/messaging
- cmd
- reconciliation
- adapters/messaging
- cmd
- service
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
212 | 228 | | |
213 | 229 | | |
214 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
95 | 143 | | |
96 | 144 | | |
97 | 145 | | |
| |||
102 | 150 | | |
103 | 151 | | |
104 | 152 | | |
| 153 | + | |
105 | 154 | | |
106 | 155 | | |
107 | 156 | | |
| |||
224 | 273 | | |
225 | 274 | | |
226 | 275 | | |
| 276 | + | |
| 277 | + | |
227 | 278 | | |
228 | 279 | | |
229 | 280 | | |
| |||
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
182 | 217 | | |
183 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
184 | 221 | | |
185 | 222 | | |
186 | 223 | | |
| |||
427 | 464 | | |
428 | 465 | | |
429 | 466 | | |
430 | | - | |
| 467 | + | |
431 | 468 | | |
432 | 469 | | |
433 | 470 | | |
| |||
592 | 629 | | |
593 | 630 | | |
594 | 631 | | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | 632 | | |
599 | 633 | | |
600 | 634 | | |
| |||
877 | 911 | | |
878 | 912 | | |
879 | 913 | | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | 914 | | |
891 | 915 | | |
892 | 916 | | |
| |||
0 commit comments