Skip to content

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.

CampoValor
Routing keyflow.execution.completed
ConsumidoresImagLend, ImagID
TriggerRules Engine emite decision final
json
{
  "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).

CampoValor
Routing keyflow.execution.failed
ConsumidoresImagID
TriggerPaso falla sin reintentos, o Rules Engine rechaza
json
{
  "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.

CampoValor
Routing keyflow.step.completed
ConsumidoresImagID
TriggerPaso ejecutado con exito
json
{
  "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.

CampoValor
Routing keyflow.version.published
ConsumidoresAudit
TriggerPOST /flows/{id}/versions/draft/publish
json
{
  "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

ProductorImagSign
AccionMarcar 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.

csharp
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

ProductorImagSign
AccionMarcar paso de firma como fallido

subject.profile.blacklisted

ProductorImagID
AccionRegistrar 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.

csharp
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 KeyExchangeQueue
flow.execution.completedimagy.eventsimagy-lending-flow-events, imagy-subject-flow-events
flow.execution.failedimagy.eventsimagy-subject-flow-events
flow.step.completedimagy.eventsimagy-subject-flow-events
flow.version.publishedimagy.eventsimagy-audit-flow-events
sign.signature.completedimagy.eventsimagy-flow-sign-events
sign.signature.rejectedimagy.eventsimagy-flow-sign-events
subject.profile.blacklistedimagy.eventsimagy-flow-subject-events

Reimagine Tech LLC — Documentacion Interna