ImagFlow — Eventos
Eventos Producidos
ImagFlow publica eventos en el exchange imagy.events con routing key flow.*.
flow.execution.completed
Se publica cuando una solicitud completa todo el ciclo: captura, procesamiento asincrono y evaluacion de reglas.
| Campo | Valor |
|---|---|
| Routing key | flow.execution.completed |
| Consumidores | ImagLend, ImagID |
| Trigger | Rules Engine emite decision final |
{
"event_id": "uuid",
"event_type": "flow.execution.completed",
"version": "1.0",
"timestamp": "2026-05-18T10:30:00Z",
"correlation_id": "uuid",
"tenant_id": "uuid",
"organization_id": "uuid",
"source": "imagy-flow-engine",
"actor_id": "uuid",
"actor_type": "system",
"data": {
"request_id": "uuid",
"flow_id": "uuid",
"flow_version_id": "uuid",
"flow_name": "Validacion de Identidad Basica",
"subject_identifier": "1234567890",
"result": "approved",
"decision": {
"action": "approve",
"rule_name": "Score biometrico alto",
"confidence": 0.95
},
"enrichments": {
"biometric_match": { "score": 95, "provider": "provider-a" },
"ocr": { "document_valid": true, "provider": "provider-b" },
"demographic": { "identity_confirmed": true }
},
"metadata": {
"origin": "imagy-lending",
"origin_id": "credit-application-uuid",
"channel": "digital",
"duration_total_ms": 45000
}
}
}flow.execution.failed
Se publica cuando una solicitud falla (paso sin reintentos, error de procesamiento, o reglas rechazan).
| Campo | Valor |
|---|---|
| Routing key | flow.execution.failed |
| Consumidores | ImagID |
| Trigger | Paso falla sin reintentos, o Rules Engine rechaza |
{
"event_id": "uuid",
"event_type": "flow.execution.failed",
"version": "1.0",
"timestamp": "2026-05-18T10:30:00Z",
"correlation_id": "uuid",
"tenant_id": "uuid",
"source": "imagy-flow-engine",
"actor_type": "system",
"data": {
"request_id": "uuid",
"flow_id": "uuid",
"flow_version_id": "uuid",
"subject_identifier": "1234567890",
"result": "rejected",
"failure_reason": "biometric_score_below_threshold",
"failure_step": "biometric-match",
"decision": {
"action": "reject",
"rule_name": "Score biometrico insuficiente",
"details": { "score": 45, "threshold": 85 }
}
}
}flow.step.completed
Se publica cada vez que un paso individual se completa exitosamente.
| Campo | Valor |
|---|---|
| Routing key | flow.step.completed |
| Consumidores | ImagID |
| Trigger | Paso ejecutado con exito |
{
"event_id": "uuid",
"event_type": "flow.step.completed",
"version": "1.0",
"timestamp": "2026-05-18T10:30:00Z",
"correlation_id": "uuid",
"tenant_id": "uuid",
"source": "imagy-flow-engine",
"actor_type": "anonymous",
"data": {
"request_id": "uuid",
"step_id": "uuid",
"step_type": "liveness",
"step_name": "Verificacion facial",
"subject_identifier": "1234567890",
"attempt_number": 1,
"provider_code": "provider-a-liveness",
"duration_ms": 3500,
"result_summary": {
"is_live": true,
"confidence": 0.98
}
}
}flow.version.published
Se publica cuando un platform admin publica una nueva version de un flujo.
| Campo | Valor |
|---|---|
| Routing key | flow.version.published |
| Consumidores | Audit |
| Trigger | POST /flows/{id}/versions/draft/publish |
{
"event_id": "uuid",
"event_type": "flow.version.published",
"version": "1.0",
"timestamp": "2026-05-18T10:30:00Z",
"tenant_id": "",
"source": "imagy-flow-engine",
"actor_id": "admin-uuid",
"actor_type": "user",
"data": {
"flow_id": "uuid",
"flow_name": "Validacion de Identidad Basica",
"version_id": "uuid",
"version_number": 3,
"previous_version_id": "uuid",
"changes_summary": "Agregado paso de firma electronica"
}
}Eventos Consumidos
ImagFlow consume eventos de otros dominios para reaccionar a cambios externos.
sign.signature.completed
| Productor | ImagSign |
|---|---|
| Accion | Marcar paso de firma como completado en la sesion de ejecucion |
Cuando un flujo tiene un paso de tipo signature, ImagFlow invoca ImagSign y espera este evento para continuar la ejecucion.
public class SignatureCompletedConsumer : BaseConsumer<SignatureCompleted>
{
protected override async Task HandleAsync(SignatureCompleted message, CancellationToken ct)
{
// Buscar la solicitud asociada a esta firma
var request = await _requestRepo.GetByMetadataAsync(
"signature_request_id", message.Data.SignatureId, ct);
if (request is null) return; // No es una firma de un flujo
// Marcar paso como completado y avanzar
await _executionService.CompleteStepAsync(
request.Id, message.Data.StepId, ct);
}
}sign.signature.rejected
| Productor | ImagSign |
|---|---|
| Accion | Marcar paso de firma como fallido |
subject.profile.blacklisted
| Productor | ImagID |
|---|---|
| Accion | Registrar en cache para evaluacion de reglas |
Cuando un sujeto es agregado a una lista negra, ImagFlow lo registra en Valkey para que el Rules Engine pueda consultarlo rapidamente durante la evaluacion.
public class SubjectBlacklistedConsumer : BaseConsumer<SubjectBlacklisted>
{
protected override async Task HandleAsync(SubjectBlacklisted message, CancellationToken ct)
{
// Cachear en Valkey para consulta rapida del Rules Engine
var key = $"blacklist:{message.Data.IdentifierType}:{message.Data.IdentifierValue}";
await _cache.SetAsync(key, new BlacklistEntry
{
TenantId = message.TenantId,
Reason = message.Data.Reason,
BlacklistedAt = message.Timestamp
}, TimeSpan.FromHours(24));
}
}Esquema de Routing
| Routing Key | Exchange | Queue |
|---|---|---|
flow.execution.completed | imagy.events | imagy-lending-flow-events, imagy-subject-flow-events |
flow.execution.failed | imagy.events | imagy-subject-flow-events |
flow.step.completed | imagy.events | imagy-subject-flow-events |
flow.version.published | imagy.events | imagy-audit-flow-events |
sign.signature.completed | imagy.events | imagy-flow-sign-events |
sign.signature.rejected | imagy.events | imagy-flow-sign-events |
subject.profile.blacklisted | imagy.events | imagy-flow-subject-events |