feat(v1.1.9): TriggerEvent::Queue + TriggerKind::Queue + types
Add the data-shape pieces for v1.1.9's queue surface; behavior lands in later commits. Each piece compiles independently. - shared/trigger_event.rs: TriggerEvent::Queue variant (queue_name, message, enqueued_at, attempt, message_id). source() returns "queue". Surfaced to scripts as ctx.event.queue with op = "receive". - manager-core/trigger_repo.rs: TriggerKind::Queue + TriggerDetails::Queue + CreateQueueTrigger + ActiveQueueConsumer + QueueDetailRow + QueueConsumerRow. PostgresTriggerRepo gains create_queue_trigger (advisory-lock-then-SELECT enforces one-consumer-per-queue), list_active_queue_consumers (dispatcher scan), touch_queue_trigger_last_fired_at. hydrate_one hydrates the Queue arm. - manager-core/outbox_repo.rs: OutboxSourceKind::Invoke for invoke_async() outbox rows. - manager-core/dispatcher.rs: placeholder OutboxSourceKind::Invoke arm (logs + drops the row) so the workspace compiles; real arm lands in commit 10. - manager-core/trigger_config.rs: queue_reclaim_interval_ms (30000) + queue_default_visibility_timeout_secs (30) env-overridable knobs. - executor-core/engine.rs: trigger_event_to_dynamic handles Queue → builds ctx.event.queue map. - manager-core/triggers_api.rs: in-memory mock TriggerRepo gains the three new methods (returns Default-ish values for tests). Unit tests: TriggerEvent::Queue serde round-trip, TriggerKind::Queue wire round-trip, advisory_lock_key stability per (app_id, queue_name) pair. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -163,6 +163,22 @@ impl Dispatcher {
|
||||
return Ok(());
|
||||
}
|
||||
},
|
||||
OutboxSourceKind::Invoke => {
|
||||
// Wired in commit 10 (invoke_async() — function composition).
|
||||
// Until then a malformed row is impossible to write (no
|
||||
// producer), but defensively drop the row so a manual
|
||||
// INSERT doesn't loop the dispatcher.
|
||||
tracing::warn!(
|
||||
outbox_id = %row.id,
|
||||
"OutboxSourceKind::Invoke not wired yet; dropping row"
|
||||
);
|
||||
self.outbox
|
||||
.delete(row.id)
|
||||
.await
|
||||
.map_err(|e| DispatcherError::Outbox(e.to_string()))?;
|
||||
drop(permit);
|
||||
return Ok(());
|
||||
}
|
||||
OutboxSourceKind::Kv
|
||||
| OutboxSourceKind::Docs
|
||||
| OutboxSourceKind::DeadLetter
|
||||
|
||||
Reference in New Issue
Block a user