Pular para o conteúdo principal
O Midaz emite eventos de domínio como mensagens CloudEvents 1.0 em modo de conteúdo binário sobre Kafka, publicados através da lib-streaming. Todo evento viaja no envelope compartilhado: ce-type nomeia o evento como studio.lerian.<resource>.<event>, ce-subject carrega o id do agregado, ce-tenantid o tenant proprietário (ausente no escopo de tenant único) e ce-schemaversion a versão do payload — 1.0.0 para todos os eventos abaixo. ce-source é configurado no deployment pela variável de ambiente STREAMING_CLOUDEVENTS_SOURCE. O ledger usa por padrão lerian.midaz.ledger e a capacidade de CRM lerian.midaz.crm. Os valores monetários — saldos, valores de transações e operações — trafegam no fio como strings decimais, nunca floats.

Eventos do ledger

Fatos que o ledger emite à medida que organizações, contas, saldos e transações mudam.

Organização

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.organization.createdlerian.streaming.organization.createdUma organização é criada.id, legalName, doingBusinessAs, legalDocument, address, status, createdAt
studio.lerian.organization.updatedlerian.streaming.organization.updatedOs campos mutáveis de uma organização mudam.id, parentOrganizationId, legalName, doingBusinessAs, address, status, updatedAt
studio.lerian.organization.deletedlerian.streaming.organization.deletedUma organização é excluída.id, deletedAt

Ledger

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.ledger.createdlerian.streaming.ledger.createdUm ledger é criado dentro de uma organização.id, organizationId, name, status, createdAt
studio.lerian.ledger.updatedlerian.streaming.ledger.updatedO nome ou o status de um ledger muda.id, organizationId, name, status, updatedAt
studio.lerian.ledger.deletedlerian.streaming.ledger.deletedUm ledger é excluído.id, organizationId, deletedAt

Conta

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.account.createdlerian.streaming.account.createdUma conta é aberta em um ledger.id, organizationId, ledgerId, name, assetCode, type, alias, portfolioId, segmentId, status, createdAt
studio.lerian.account.updatedlerian.streaming.account.updatedOs campos mutáveis de uma conta mudam.id, organizationId, ledgerId, name, segmentId, entityId, status, blocked, updatedAt
studio.lerian.account.deletedlerian.streaming.account.deletedUma conta é excluída.id, organizationId, ledgerId, portfolioId, deletedAt

Ativo

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.asset.createdlerian.streaming.asset.createdUm ativo é registrado em um ledger.id, organizationId, ledgerId, name, type, code, status, createdAt
studio.lerian.asset.updatedlerian.streaming.asset.updatedOs campos mutáveis de um ativo mudam.id, organizationId, ledgerId, name, type, code, status, updatedAt
studio.lerian.asset.deletedlerian.streaming.asset.deletedUm ativo é excluído.id, organizationId, ledgerId, deletedAt

Portfólio

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.portfolio.createdlerian.streaming.portfolio.createdUm portfólio é criado.id, organizationId, ledgerId, name, entityId, status, createdAt
studio.lerian.portfolio.updatedlerian.streaming.portfolio.updatedOs campos mutáveis de um portfólio mudam.id, organizationId, ledgerId, name, entityId, status, updatedAt
studio.lerian.portfolio.deletedlerian.streaming.portfolio.deletedUm portfólio é excluído.id, organizationId, ledgerId, deletedAt

Segmento

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.segment.createdlerian.streaming.segment.createdUm segmento é criado.id, organizationId, ledgerId, name, status, createdAt
studio.lerian.segment.updatedlerian.streaming.segment.updatedOs campos mutáveis de um segmento mudam.id, organizationId, ledgerId, name, status, updatedAt
studio.lerian.segment.deletedlerian.streaming.segment.deletedUm segmento é excluído.id, organizationId, ledgerId, deletedAt

Rota de operação

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.operation-route.createdlerian.streaming.operation-route.createdUma rota de operação é criada.id, organizationId, ledgerId, title, code, operationType, account, accountingEntries, createdAt
studio.lerian.operation-route.updatedlerian.streaming.operation-route.updatedOs campos mutáveis de uma rota de operação mudam.id, organizationId, ledgerId, title, code, operationType, account, accountingEntries, updatedAt
studio.lerian.operation-route.deletedlerian.streaming.operation-route.deletedUma rota de operação é excluída.id, organizationId, ledgerId, deletedAt

Rota de transação

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.transaction-route.createdlerian.streaming.transaction-route.createdUma rota de transação é criada.id, organizationId, ledgerId, title, operationRouteIds, createdAt
studio.lerian.transaction-route.updatedlerian.streaming.transaction-route.updatedOs campos mutáveis de uma rota de transação mudam.id, organizationId, ledgerId, title, operationRouteIds, updatedAt
studio.lerian.transaction-route.deletedlerian.streaming.transaction-route.deletedUma rota de transação é excluída.id, organizationId, ledgerId, deletedAt

Saldo

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.balance.createdlerian.streaming.balance.createdUm saldo é criado durante a configuração da conta.id, organizationId, ledgerId, accountId, alias, key, assetCode, accountType, available, onHold, allowSending, allowReceiving, createdAt
studio.lerian.balance.changedlerian.streaming.balance.changedUma transação confirmada move um saldo — um evento por operação que afeta o saldo; os valores refletem o estado após a operação.organizationId, ledgerId, accountId, balanceId, assetCode, available, onHold, version, reason, direction, amount, transactionId, operationId, occurredAt
studio.lerian.balance.config-changedlerian.streaming.balance.config-changedAs configurações de um saldo mudam, ou o cheque especial é habilitado (o saldo acompanhante é materializado). changeType distingue settings_updated de overdraft_enabled.id, organizationId, ledgerId, accountId, allowSending, allowReceiving, direction, settings, changeType, updatedAt
studio.lerian.balance.deletedlerian.streaming.balance.deletedUm saldo é excluído.id, organizationId, ledgerId, accountId, deletedAt
studio.lerian.balance.overdraft-drawnlerian.streaming.balance.overdraft-drawnUm débito consome cheque especial além dos fundos disponíveis (action = drawn).balanceId, accountId, organizationId, ledgerId, assetCode, transactionId, operationId, action, amount, overdraftBalance, overdraftLimit, occurredAt
studio.lerian.balance.overdraft-repaidlerian.streaming.balance.overdraft-repaidO uso do cheque especial diminui, mas não é totalmente quitado (action = repaid).balanceId, accountId, organizationId, ledgerId, assetCode, transactionId, operationId, action, amount, overdraftBalance, overdraftLimit, occurredAt
studio.lerian.balance.overdraft-clearedlerian.streaming.balance.overdraft-clearedO cheque especial é totalmente quitado — sinal terminal (action = cleared).balanceId, accountId, organizationId, ledgerId, assetCode, transactionId, operationId, action, amount, overdraftBalance, overdraftLimit, occurredAt

Transação

Os quatro eventos do ciclo de vida compartilham um mesmo payload; apenas o tipo de roteamento muda.
Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.transaction.postedlerian.streaming.transaction.postedUma transação recém-criada é confirmada no armazenamento com todas as suas operações persistidas (sem pai).id, organizationId, ledgerId, status, amount, assetCode, source, destination, route, operations, metadata, createdAt
studio.lerian.transaction.committedlerian.streaming.transaction.committedUma transação pendente passa de PENDING para APPROVED.id, organizationId, ledgerId, status, amount, assetCode, source, destination, operations, metadata
studio.lerian.transaction.canceledlerian.streaming.transaction.canceledUma transação pendente passa de PENDING para CANCELED.id, organizationId, ledgerId, status, amount, assetCode, source, destination, operations, metadata
studio.lerian.transaction.revertedlerian.streaming.transaction.revertedUm fluxo de reversão cria uma transação filha; parentTransactionId a correlaciona com a original.id, parentTransactionId, organizationId, ledgerId, status, amount, assetCode, source, destination, operations, metadata

Eventos do CRM

A capacidade de CRM do Midaz gerencia os titulares de contas e seus aliases. Esses eventos são emitidos no source do CRM (lerian.midaz.crm por padrão), separado do ledger, mas seguem o mesmo envelope e versionamento.

Titular

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.holder.createdlerian.streaming.holder.createdUm titular é criado.id, organizationId, type, externalId, createdAt
studio.lerian.holder.updatedlerian.streaming.holder.updatedOs campos mutáveis de um titular mudam.id, organizationId, type, externalId, updatedAt
studio.lerian.holder.deletedlerian.streaming.holder.deletedUm titular é excluído.id, organizationId, deletionType, deletedAt

Alias

Evento (ce-type)TópicoQuando disparaPayload principal
studio.lerian.alias.createdlerian.streaming.alias.createdUm alias é criado para um titular e uma conta.id, holderId, organizationId, ledgerId, accountId, type, relatedParties, createdAt
studio.lerian.alias.updatedlerian.streaming.alias.updatedOs campos mutáveis de um alias mudam.id, holderId, organizationId, ledgerId, accountId, type, relatedParties, updatedAt
studio.lerian.alias.deletedlerian.streaming.alias.deletedUm alias é excluído.id, holderId, organizationId, deletionType, deletedAt
studio.lerian.alias.related-party-deletedlerian.streaming.alias.related-party-deletedUma parte relacionada é removida de um alias.aliasId, holderId, organizationId, relatedPartyId, deletedAt