fix: route unload events to domestic bridge

This commit is contained in:
2026-08-24 23:43:08 +08:00
parent 058bf9f4e6
commit a22a284e7d
6 changed files with 25 additions and 4 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ baiyue:
warehouse:
base-url: ${WAREHOUSE_OVERSEAS_SERVICE_URL:http://warehouse-overseas-service:9305}
firstleg:
event-bridge-url: ${FIRSTLEG_EVENT_BRIDGE_URL}
event-bridge-url: ${CN_EVENT_BRIDGE_URL:${FIRSTLEG_EVENT_BRIDGE_URL}}
outbox-relay:
fixed-delay-ms: ${FIRSTLEG_OUTBOX_RELAY_FIXED_DELAY_MS:5000}
lease-seconds: ${FIRSTLEG_OUTBOX_RELAY_LEASE_SECONDS:60}
+6 -1
View File
@@ -58,7 +58,8 @@ services:
LASTLEG_DB_URL: ${LASTLEG_DB_URL}
LASTLEG_DB_USERNAME: ${LASTLEG_DB_USERNAME}
LASTLEG_DB_PASSWORD: ${LASTLEG_DB_PASSWORD}
FIRSTLEG_EVENT_BRIDGE_URL: ${FIRSTLEG_EVENT_BRIDGE_URL}
CN_EVENT_BRIDGE_URL: ${CN_EVENT_BRIDGE_URL:-http://event-bridge-cn:9312}
FIRSTLEG_EVENT_BRIDGE_URL: ${CN_EVENT_BRIDGE_URL:-http://event-bridge-cn:9312}
DOMESTIC_WAREHOUSE_URL: ${DOMESTIC_WAREHOUSE_URL}
FILE_SERVICE_URL: ${FILE_SERVICE_URL}
WAREHOUSE_OVERSEAS_SERVICE_URL: ${WAREHOUSE_OVERSEAS_SERVICE_URL:-http://warehouse-overseas-service:9305}
@@ -89,6 +90,10 @@ services:
EVENT_BRIDGE_DB_USERNAME: ${EVENT_BRIDGE_OVERSEAS_DB_USERNAME}
EVENT_BRIDGE_DB_PASSWORD: ${EVENT_BRIDGE_OVERSEAS_DB_PASSWORD}
EVENT_CONSUMER_URL: ${EVENT_CONSUMER_URL:-http://lastleg-service:9303/internal/lastleg/events}
networks:
firstleg-overseas-network:
infra-network:
aliases: [event-bridge-overseas]
networks:
firstleg-overseas-network:
+4
View File
@@ -245,6 +245,10 @@ services:
EVENT_CONSUMER_URL: ${FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http://firstleg:9202/internal/firstleg/v1/container-events}
FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL: ${FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http://firstleg:9202/internal/firstleg/v1/container-events}
SPRING_SQL_INIT_MODE: never
networks:
firstleg-network:
infra-network:
aliases: [event-bridge-cn]
audit-service:
<<: *common
@@ -53,6 +53,11 @@ test('canonical states, ten ordered nodes, exception codes and complete payload
'locationCode', 'locationName', 'reason'])
})
test('actual node timestamps advance from the frozen outbound-confirm fact instead of the runner timezone', () => {
assert.match(source, /Date\.parse\(`\$\{frozenLatestActual\}Z`\)/)
assert.match(source, /frozenLatestActualMs\) \? Date\.now\(\) : frozenLatestActualMs/)
})
test('module exposes no scheduler, attempt, internal or arbitrary stop endpoint', () => {
assert.match(source, /\/manual-nodes/)
assert.match(source, /'Idempotency-Key'/)
@@ -184,7 +184,10 @@ export async function run(context) {
`version=${detail?.query?.query?.version ?? 'missing'}, nodes=${detail?.nodes?.length ?? 'missing'}`, OPTIONS)
let version = Number(detail.query.query.version)
const baseActual = Date.now() + 60 * 60_000
const frozenLatestActual = detail?.query?.query?.latestActualAt
const frozenLatestActualMs = frozenLatestActual == null ? Number.NaN
: Date.parse(`${frozenLatestActual}Z`)
const baseActual = (Number.isNaN(frozenLatestActualMs) ? Date.now() : frozenLatestActualMs) + 60 * 60_000
for (let index = 0; index < STANDARD_NODES.length; index += 1) {
const standardNode = STANDARD_NODES[index]
const actualAt = localIso(new Date(baseActual + index * 60_000))
@@ -53,6 +53,9 @@ test('overseas compose is isolated from CN defaults and disables implicit schema
assert.match(compose, /EVENT_BRIDGE_DB_URL: \$\{EVENT_BRIDGE_OVERSEAS_DB_URL\}/)
assert.match(compose, /EVENT_BRIDGE_DB_USERNAME: \$\{EVENT_BRIDGE_OVERSEAS_DB_USERNAME\}/)
assert.match(compose, /EVENT_BRIDGE_DB_PASSWORD: \$\{EVENT_BRIDGE_OVERSEAS_DB_PASSWORD\}/)
assert.match(compose, /CN_EVENT_BRIDGE_URL: \$\{CN_EVENT_BRIDGE_URL:-http:\/\/event-bridge-cn:9312\}/)
assert.match(compose, /FIRSTLEG_EVENT_BRIDGE_URL: \$\{CN_EVENT_BRIDGE_URL:-http:\/\/event-bridge-cn:9312\}/)
assert.match(compose, /aliases: \[event-bridge-overseas\]/)
})
test('CN and overseas event bridges have explicit opposite-region consumers', async () => {
@@ -66,10 +69,11 @@ test('CN and overseas event bridges have explicit opposite-region consumers', as
assert.match(cn, /EVENT_CONSUMER_URL:http:\/\/firstleg:9202\/internal\/firstleg\/v1\/container-events/)
assert.match(overseas, /EVENT_CONSUMER_URL:http:\/\/lastleg-service:9303\/internal\/lastleg\/events/)
assert.match(cnCompose, /EVENT_CONSUMER_URL: \$\{FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http:\/\/firstleg:9202\/internal\/firstleg\/v1\/container-events\}/)
assert.match(cnCompose, /aliases: \[event-bridge-cn\]/)
assert.match(overseasCompose, /EVENT_CONSUMER_URL: \$\{EVENT_CONSUMER_URL:-http:\/\/lastleg-service:9303\/internal\/lastleg\/events\}/)
assert.match(firstleg, /LASTLEG_EVENT_BRIDGE_URL/)
assert.match(firstleg, /LASTLEG_OUTBOX_RELAY_LEASE_SECONDS/)
assert.match(lastleg, /FIRSTLEG_EVENT_BRIDGE_URL/)
assert.match(lastleg, /CN_EVENT_BRIDGE_URL:\$\{FIRSTLEG_EVENT_BRIDGE_URL\}/)
assert.match(lastleg, /WAREHOUSE_OVERSEAS_SERVICE_URL:http:\/\/warehouse-overseas-service:9305/)
assert.match(scripts, /FIRSTLEG_EVENT_BRIDGE_URL/)
assert.match(scripts, /LASTLEG_EVENT_BRIDGE_URL/)