Skip to content

Events

Este documento detalla los mecanismos de mensajería utilizados en el microservicio de Gestión de Reabastecimiento, específicamente el uso de Amazon Simple Notification Service (SNS) para la comunicación asíncrona entre servicios.

Nombre: restocking-manager-alert-created-topic.fifo

Propósito: Notificar a otros servicios cuando se crea un reabastecimiento.

ARN en Producción:

arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-created-topic.fifo

ARN en Staging:

arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-created-topic.fifo

Deduplicación: Se utiliza el ID de restocking como ID de deduplicación:

const deduplicationId = 'created-' + restocking.id.value

Agrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:

const groupId = restocking.product.ean.value

Formato del mensaje:

export interface RestockingCreatedMessage {
type: 'RestockingCreated'
data: {
restockingId: string
productEan: string
productSku: string
productName: string | null
type: RestockingType
level: RestockingLevel
status: RestockingStatus
}
context: {
country: string
warehouse: string
}
}

Nombre: restocking-manager-alert-updated-topic.fifo

Propósito: Notificar a otros servicios cuando se actualiza un reabastecimiento.

ARN en Producción:

arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-updated-topic.fifo

ARN en Staging:

arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-updated-topic.fifo

Deduplicación: Se utiliza el ID de restocking como ID de deduplicación:

const deduplicationId = 'updated-' + restocking.id.value

Agrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:

const groupId = restocking.product.ean.value

Formato del mensaje:

export interface RestockingUpdatedMessage {
type: 'RestockingUpdated'
data: {
restockingId: string
productEan: string
productSku: string
productName: string | null
type: RestockingType
level: RestockingLevel
status: RestockingStatus
}
context: {
country: string
warehouse: string
}
}

Nombre: restocking-manager-alert-completed-topic.fifo

Propósito: Notificar a otros servicios cuando se completa un reabastecimiento.

ARN en Producción:

arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-completed-topic.fifo

ARN en Staging:

arn:aws:sns:us-east-2:529305108461:restocking-manager-alert-completed-topic.fifo

Deduplicación: Se utiliza el ID de restocking como ID de deduplicación:

const deduplicationId = 'completed-' + restocking.id.value

Agrupación de mensajes: Los mensajes se agrupan por EAN del producto para garantizar el orden dentro de cada grupo:

const groupId = restocking.product.ean.value

Formato del mensaje:

export interface RestockingCompletedMessage {
type: 'RestockingCompleted'
data: {
restockingId: string
productEan: string
productSku: string
productName: string | null
type: RestockingType
level: RestockingLevel
status: RestockingStatus
}
context: {
country: string
warehouse: string
}
}

Nombre: restocking-manager-alert-restock-topic

Propósito: Notificar a otros servicios cuando sé registrar un restock en un reabastecimiento.

ARN en Producción:

arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-restock-topic

ARN en Staging:

arn:aws:sns:us-east-1:849786826922:restocking-manager-alert-restock-topic

Formato del mensaje:

export interface RestockingRestockMessage {
type: 'RestockingRestock'
data: {
restockingId: string
productEan: string
productSku: string
productName: string | null
type: RestockingType
level: RestockingLevel
status: RestockingStatus
entryId: string
transactionId: string
quantity: number
restockedAt: string
}
context: {
country: string
warehouse: string
}
}

Nombre: restocking-manager-restock-registered-topic

Propósito: Notificar a otros servicios cuando se registra un restock.

ARN en Producción:

arn:aws:sns:us-east-1:849786826922:restocking-manager-restock-registered-topic

ARN en Staging:

arn:aws:sns:us-east-2:529305108461:restocking-manager-restock-registered-topic

Formato del mensaje:

export interface RestockRegisteredMessage {
type: 'RestockRegistered'
data: {
id: string
ean: string
target: string
source: string
quantity: number
user: string
timestamp: string
alertId?: string
level?: string
zone?: string
}
context: {
country: string
warehouse: string
}
}